Jenkins rest api see if a node online using REST API - api

what i would like to have is that if the node online, hit 200 status code else hit 404 status code. So that i know whether it is up running or down. I tried below but not working
https://(Jenkins IP and Port)/computer/Jenkins-Slave/api/json?tree=offline&offline=true&pretty=true

Related

The API request failed with the following error: 200 - OK

I administer my shared hosting through cPanel.
It is showing "The API request failed with the following error: 200 - OK." in red popup.
Everything is working fine. I can work on everything as usual, but still this pop?
When i login from another browser, the error is not shown.
How to get rid of it and why is this being shown?
How to get rid of this message was my question.
I had installed a chrom plugin that allowed me to use CORS.
After uninstalling this plugin, the error was gone.

WT 8-1: Getting HTTP GET on resource 'http://training4-american-api-maryumsiddique.us-e2.cloudhub.io:80/flights' failed: not found (404)

I'm doing mule 4 training and currently I'm on WT 8-1. I followed all the steps as they told and when I run the project it deployed successfully. But when I call "http://localhost:8081/american" from postman it gives me the following error.
Although the status is Started on Runtime Manager as below.
In API Manager the status is Active as well.
And I cannot figure out what's the issue. Can anyone please tell me what should I do?
Really appreciate the help 🙂
Likely your app deployed locally is not calling the right URL for the API deployed in CloudHub. Maybe the URL should be http://training4-...cloudhub.io/api/flights or something like it.

Cache an Express REST route on browser side

is there a way to sent the browser, that he should cache the response/body (json) for minutes/hours/days?
I want to reduce server request and one a specific route where the content change very rarely (probably once a week). This will reduce the traffic on the client side aswell.
i've tried with:
res.set('Cache-Control', 'public, max-age=6000');
res.set('Expires', new Date(Date.now() + 60000).toUTCString());
res.set('Prgama', 'cache');
but chrome ignores that, but maybe that's wrong. Im clueless and google didn't help yet.
Final result should be like (Chrome Network Tab):
First Client request: Status Code 200 OK
Second Client request: STatus Code OK (from disk cache)
etc.
After the the time expires, again the Status Code 200 OK (WITHOUT from disk cache) like static files (images) works.
I only find server side caching, but this won't reduce GET requests to the Backend.

How ApacheBench can follow redirection

I use AB(ApacheBench), Version 2.3.
I'm trying to test "http://localhost/myPage" with Basic Authentication.
There isn’t any problem when I use web browser like I.E.
The apache’s log message shows HTTP response code changing 401->301->200.
It saied my http request was finished successfully.
But when I use AB , result is different .
AB saied request was completed but Apache’s log shows status has stopped at 301.
Now,My question is how to get AB follows to redirect 301.
Based on my research AB doesn't follow redirects. I haven't checked the source code but I did a fair share of testing and googling around. My testing involved running AB tests and checking the access log. I was able to get redirects working with wget.
At one point I gave up on AB and installed siege instead, see http://www.joedog.org/siege-home/ for more details.
Turns out "localhost/myPage" isn't correct path. I should have instead included a "/" at the end of URL like "localhost/myPage/". Now AB follows redirect 301.

Custom JSON IErrorHandler in WCF returning StatusCode 200/504 when should return 400

I have a WCF service that among other bindings also uses WebHttpBinding for JSON inputs/results.
I made a custom IErrorHandler implementation in order to be able to set the StatusCode to 400 when something goes wrong and also return a JSON understandable message. It´s the straight implementation that you can find everywhere (nice way described here).
My problem is: when I test it locally using Visual Studio Web Development Server (Cassini) it works perfectly. However, when I deploy it to my test server (Windows 2008 with standard config for IIS and everything else) it does not work.
When I call it and debug with Firebug I get a HttpStatusCode 200 as a return and no response text. With Fiddler I get a HttpStatusCode 504 and no return at all. However, the behavior I expected (and what happens locally) is a call to the error callback of the ajax call with the responseText set.
I debugged it remotely and everything looks just fine. The execution pipeline is OK and all the classes are called as they should be just like they are locally, except it does not work.
Any suggestions? I´m pretty much out of options here to figure this out.
Thanks a lot!
if firebug and fiddler are giving different results, what happens if you telnet to it directly and perform a request (Something like:)
GET /VirtualDirectoryAndGetData HTTP/1.1
HOST: example.com
[carriage return]
It wouldn't surprise me if you're somehow getting odd headers/formatting back (to explain why firebug/fiddler disagree)
Another thing to test would be publishing to your dev machine to see if it's a machine-specific issue or a server vs dev webserver issue.
If it's happening anywhere outside VS, you might also try commenting out the lines where you set
rmp.StatusCode = System.Net.HttpStatusCode.BadRequest;
rmp.StatusDescription = "Bad request";
This may indicate whether it's a response code issue or an error handler issue.
If you can edit your question to include the results (with sensitive info removed), we'll see if we can track it down further.
Edit: after looking at the question again, it may well be that the server is erroring before it can send ANY response. FF might assume 200 by default, whereas ie might assume 504 (Gateway Timeout). This is total speculation but is possible. Do you see anything in the event logs?
I had a similar issue which I was able to solve. Take a look at the IIS settings. Details on how I overcame the issue are in this post: IErrorHandler returning wrong message body when HTTP status code is 401 Unauthorized