Hi,
We need support to get monitor status in site 24x7 via REST API. I followed the doument here:
www.site24x7.com/help/api/#getting-started
Steps I did:
1) Created an access token with the following command:
curl accounts.zoho.eu/oauth/v2/token -X POST -d "client_id=1000.***" -d "client_secret=***" -d "code=1000.***" -d "grant_type=authorization_code"
Code was obtained from the self client with the scope "Site24x7.Reports.Read"
api-console.zoho.eu/client/1000.SA55EPV7G2JSGCURZUTQOBJRPY8FSR
2) Tried to get the monitor status with the generated access token using the following command:
curl www.site24x7.eu/api/current_status/3079000000007006 -X GET -H "Accept: application/json; version=2.0" -H "Authorization: Zoho-oauthtoken <access token***>"
I get the following error, where I'm not authorized to perform this operation>
{"error_code":1100,"message":"You are not authorized to perform this operation"}
Please let us know what permission is requied to make the API call work ?
We also need to know how to increase or disable the expiry of access token.
Following is the account details:
Jerald Sabu M
Hi Jerald,
You are accessing data of a monitor in MSP Customer account. You need to pass an additional header with zaaid of the customer account.
Example:
-H "Cookie: zaaid=657637305"
You can get the zaaid of customer accounts using api /short/msp/customers
https://www.site24x7.com/help/api/#msp-api
Thillai.
Hi Thillai,
I tried to generate the zaaid, as you mentioned however I get an other mentioned below, please let me know how do I resolve this ?
curl www.site24x7.eu/api/short/msp/customers -H "Content-Type: application/json;charset=UTF-8" -H "Accept: application/json; version=2.0" -H "Authorization: Zoho-oauthtoken 1000.**"
{"error_code":1121,"message":"OAuth Scope associated to the OAuth Access Token is disallowed."}
I would also like to know, how to generate the access token permanently so that it does not expire.
Regards,
Jerald
Hi Thillai,
I managed to generate the zaaid ID with the scope "Site24x7.Msp.All", however, I m still not able to get the monitor status.
I used both the scope "Site24x7.Reports.All" and "Site24x7.Msp.All" to generate an access token, however, I get the following error for both.
curl "www.site24x7.eu/api/monitors" GET -H "Accept: application/json; version=2.0" -H "Cookie: zaaid=20063642213" -H "Authorization: Zoho-oauthtoken code=1000.***"
{"error_code":1120,"message":"OAuth Access Token is invalid or has expired."}
Please let me know, how do I resolve this?
I would also like to know, how to generate the access token permanently so that it does not expire.
Regards,
Jerald
Hi Thillai,
I managed to get the availability with the scope "Site24x7.Reports.All" , the earlier query was different.
curl "www.site24x7.eu/api/availability/monitor/3079000000007006?period=4" -X GET -H "Accept: application/json; version=2.0" -H "Authorization: Zoho-oauthtoken 1000.***" -H "Cookie: zaaid=20063642213"
Now my question is, is it possible to extend the access token for a wide period for example 1 year? instead of generating it every hour ?
Hi Jerald,
Sorry, it is not possible to change the expiry time for access token. One hour is the typical time followed by OAuth 2.0 providers.
Thillai.