I am writing a tool that interrogates systems supported by our team and uploading the data to New Relic for up-time reporting, metrics (if available), and alerting.
The documentation is limited on how to call ‘api/system/health’.
How to format the API call http://sonar.blah.com/api/system/health?<some_login>=<token_here>
Can I use a token or is there a username/password that needs to be created
What is the expected output/format of the json response {"health":"GREEN","causes":[]}
More specifically what could go into the array after "causes":[]
Any help would certainly be appreciated, I’ve been searching every resource I could but haven’t had much luck.
You can find an example of the output format in the embedded api documentation, or our live example here
About the message you can find in the causes, there is no official list : this is just plaintext, mean to be human readable. you can find example of Strings by browsing the source code here.
Unfortunately for me when I try the query, the API is responding with a 403 Forbidden. I’m using Postman, and I’ve imported the curl command.
The response is {"errors":[{"msg":"Insufficient privileges"}]}
Can you help me understand if there is configuration that is needed before I can use my token? If I visit those URL’s while logged in, I see valid responses.
How do I convert this curl into a REST call? Is there a param to put after /api/system/health?
In addition to the answer
1. Open POSTMAN
2. Click on "import" tab on the upper left side.
3. Select the Raw Text option and paste your cURL command.
4. Hit import and you will have the command in your Postman builder!
5. If -u admin:admin are not imported, just go to the Authorization
tab, select Basic Auth -> enter the user name eg admin and password eg admin.
This will automatically generate Authorization header based on Base64 encoder