Name | Description | Type | Category | Value |
comm.api.uri | API End Point | Text | Commission | https://<tenatid>. callidusondemand.com/api/v2 |
comm.api.user | User with Proper Authorization | Text | Commission | <User Id> |
comm.api.password | Password | Password | Commission | <Password> |
def fnPrepareCommHeaders(){
def oHeaders = new java.util.HashMap();
oHeaders.put('content-type','application/json');
oHeaders.put('Accept', 'application/json');
def sUser = resp.getAppParam("comm.api.user");
def sPassword = resp.getAppParam("comm.api.password");
def sCredentials = sUser + ":" + sPassword ;
def b64Credentials = sCredentials.bytes.encodeBase64().toString();
def sAuthorizationHeader = "Basic " + b64Credentials;
oHeaders.put('Authorization', sAuthorizationHeader);
return oHeaders;
}
def fnCallCommissionsAPI(sMethod, sUrl, sBody){
def oResponse;
def oHttpClient = resp.createHttpClient();
def oHeaders = fnPrepareCommHeaders();
String sURL = resp.getAppParam("comm.api.uri") + sUrl;
switch(sMethod){
case 'GET':
oResponse = oHttpClient.executeHttpGet(sURL, oHeaders);
break;
case 'POST':
oResponse = oHttpClient.executeHttpPost(sURL, 'application/json', oHeaders, sBody);
break;
case 'PUT':
oResponse = oHttpClient.executeHttpPut(sURL, 'application/json', oHeaders, sBody);
break;
case 'DELETE':
oResponse = oHttpClient.executeHttpDelete(sURL, oHeaders);
break;
default:
break;
}
return oResponse;
}
import groovy.json.JsonSlurper;
def utilCommApi = resp.importScript("commissions_functions");
def sResponse = utilCommApi.invoke("fnCallCommissionsAPI", 'GET', '/periods','')
def jsonSlurper = new JsonSlurper()
def jsonResponse = jsonSlurper.parseText(sResponse.getContent());
logger.info("Periods-:", jsonResponse);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |