Hi Everyone,
We are trying to add web services after operation rule for account aggregation but not sure where our code is failing, below is our code.
<?xml version='1.0' encoding='UTF-8'?> Describe your rule here.Hi Everyone,
We are trying to add web services after operation rule for account aggregation but not sure where our code is failing, below is our code.
<?xml version='1.0' encoding='UTF-8'?> Describe your rule here.Hi Jagdish!
Can you please elaborate on what you are trying to do with this rule? You mentioned this is for account aggregation, what is wrong with the normal HTTP Operation for Account Aggregation that an After Operation rule is also needed?
Additionally, I took the liberty of formatting your code fully for this forum so others can look at it more clearly. It looks like your code block got split when you initially posted. Please be sure to include all of your code in the triple `s that denote a code block.
import connector.common.JsonUtil;
import sailpoint.connector.webservices.WebServicesClient;
import com.google.gson.Gson;
import sailpoint.tools.Util;
try {
WebServicesClient client = new WebServicesClient();
String url = "https://abc-sb.api.identitynow.com/oauth/token";
String clientId = "xyz";
String clientSecret = "abc";
String grantType = "client_credentials";
Map payload = new HashMap();
payload.put("jsonBody","{\"grant_type\":\"" + grantType + "\",\"client_id\":\"" + clientId + "\",\"client_secret\":\"" + clientSecret + "\"}");
Map args = new HashMap();
args.put(WebServicesClient.ARG_URL, url);
client.configure(args);
Map header = new HashMap();
// debugrmation can be fetched from requestEndpoint and updated in the header and body header.put("Accept","application/json"); header.put("Content-Type","application/json");
List<String> allowedStatuses = new ArrayList();
allowedStatuses.add("200");
String authresponse = client.executePost(url, payload, header, allowedStatuses);
log.debug("authResponse: " + authResponse);
Map authResponseMap = (Map) JsonUtil.toMap(authResponse);
log.debug("authResponseMap---"+ authResponseMap);
String tokenGenerated = authResponseMap.get("access_token");
log.debug("tokenGenerated: " + tokenGenerated);
String url1 = "https://abc-sb.api.identitynow.com/cc/api/source/loadAccounts/200794?disableOptimization=true";
header.put("Authorization", "Bearer " + tokenGenerated);
String response1 = client.executePost(url1, header, allowedStatuses);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.