Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

Multiple Rest API calls in ConnectionJson

yogendragautam
New Contributor II
New Contributor II

Hi,

 

We have a requirement whee we have to use 2 API calls to get the access token.

The first API call returns access token in the response & second API call returns another larger access token. We need the access token which we get after the second API call. This access token will be used in creating/updating the accounts.

We need to send the access token which we got in the first API call as a http parameter to the second api call. How can we refer to this access token ?

 

Thanks.

4 REPLIES 4

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @yogendragautam,

Yes, this is doable, Please see the sample json below modify as per your needs.
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpParamsName": "password",
"call": {
"call1": {
"callOrder": 0,
"url": "********************",
"httpMethod": "POST",
"httpHeaders": {
"contentType": "application/json",
"Accept": "application/json",
"Authorization": "password"
},
"httpContentType": "application/json",
"keyPath": "",
\\ please populate the traversing path to the password
"successResponses": {
"statusCode": [
200,
201,
202,
203,
204,
205
]
}
}
},
"url": "https://URL/",
"httpMethod": "POST",
"httpParams": "{\"username\":\"<userid>\",\"password\":\"<password>\"}",
"httpHeaders": {
"contentType": "application/json",
"Accept": "application/json"
},
"httpContentType": "application/json",
"authError": [
"Maximum number of concurrent users reached",
"Unknown user or wrong password",
"License Invalid",
"Password expired",
"Number of reserved licenses reached",
"User has no authorization"
],
"timeOutError": "Read timed out",
"retryFailureStatusCode": [
401,
403
],
"errorPath": "ErrorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "Value.Identifier",
"tokenType": "",
"accessToken": "sjahdkjhkfjahkq"
}
}
}

"httpParamsName": "password", (We are storing the password here and utlizing in call2)


If you find the above response useful, Kindly Mark it as "Accept As Solution".

Hi,

Are you saying that instead of password, i should use access_token ? since that is what I want to pass to the second api call ?

Also, traversing path to the access_token, I am not sure on this, We can do this in createaccount and other jsons, is it similar to that ? (example: call1.msg. etc..) ?

 

Also, what does "tokenResponsePath": "Value.Identifier" indicate in the json provided above ?

can you please highlight where exactly are you using the response of access token got from first api call as a http parameter to second api call ?

 

 

sudeshjaiswal
Saviynt Employee
Saviynt Employee

Hello @yogendragautam,

Let me keep it simple :- We are doing the call-1 in that we are storing response in password variable and in the call-2 we are passing the password variable in the url <<"{\"username\":\"<userid>\",\"password\":\"<password>\"}",>> to get the token.

Also, what does "tokenResponsePath": "Value.Identifier" indicate in the json provided above ?
you have to give the traversing path of the token being genrated after call2.

Please provide the postman response for both the token being genrated and also the url. (Please share the connections json in the private message once you modify it as per the above given sample).

Thanks.

If you find the above response useful, Kindly Mark it as "Accept As Solution".

@yogendragautam ,

You may refer to "Renew Access Token and Refresh Token using Different API" section in REST developers handbook. It allows you to make two API calls to obtain final access token.