4 years ago
Citrix Cloud Monitoring
Installation
1. Install the package from LM Exchange "Citrix Cloud"
2. Install Cloud Connector property source: Locator JYW9D7
Configuration
This datasource ...
Hello,
I am new to LM, and have managed to setup the Citrix Cloud.
We would have to migrate to the new Citrix Cloud API by 30th June and i am struggling to modify the Citrix_Cloud_OAuth_Token..
Any help\guidance\direction would be appreciated.
Following is the partial code that fails with the error below :
def clientId = hostProps.get("citrix.cloud.id");
def clientSecret = hostProps.get("citrix.cloud.pass");
def devid = hostProps.get("system.deviceID");
// post the request, add the above parameters to the body of request
CloseableHttpClient httpclient = HttpClients.createDefault();
httpPost = new HttpPost("https://api-us.cloud.com/cctrustoauth2/root/tokens/clients");
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
httpPost.setEntity(new StringEntity("{\'grant_type\':\'client_credentials\',\'client_id\':\'" + clientId + "\',\'client_secret\':\'" + clientSecret + "\'}", ContentType.create("application/json")));
response = httpclient.execute(httpPost);
responseBody = EntityUtils.toString(response.getEntity());
ctxcode = response.getStatusLine().getStatusCode();
// Parse the bearer token from the JSON output
json_slurper = new JsonSlurper();
response_obj = json_slurper.parseText(responseBody);
httpclient.close();
=======================================================
Error returned :
"error": "unsupported_grant_type",
"error_description": "grant_type must be set to client_credentials"
========================================================
Thanks