We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Create REST Connection using Session ID

Kumat
New Contributor
New Contributor

Hello,

I'm building a REST connection to get the data using session ID. So, Trying to get more details on how can I build a connection using session ID. Below is the scenario

Using postman I add the username, password and POST URL when i run the post call i get the session ID. I need to use the session ID to get the user and entitlement details. 

I take the session ID, add it in the authorization field in the headers and I add a query in the body. i run the post call and I see data in the postman.

Need to understand how can I build connection using username, password and session ID as session ID is being used in a different call. 

Please note session ID is dynamic will be changed every 24 hours.

Appreciate your suggestions.

3 REPLIES 3

SB
Saviynt Employee
Saviynt Employee

You can try the below json format to store session id in Access token and use the ${access_token} variable in your Import Json.

{
  "authentications": {
    "userAuth": {
      "authType": "oauth2",
      "url": "<URL>",
      "httpMethod": "POST",
      "httpParams": {},
      "httpHeaders": {
        "contentType": "application/x-www-form-urlencoded"
      },
      "httpContentType": "application/x-www-form-urlencoded",
      "expiryError": "ExpiredAuthenticationToken",
      "authError": [
        "InvalidAuthenticationToken",
        "AuthenticationFailed",
        "FAILURE",
        "INVALID_SESSION_ID"
      ],
      "timeOutError": "Read timed out",
      "errorPath": "errors.type",
      "maxRefreshTryCount": 5,
      "tokenResponsePath": "sessionId",
      "tokenType": "Bearer",
      "accessToken": "Bearer <abcde",
"retryFailureStatusCode": [
401,
403
] } } }

 Also below is the link to the REST Connector guide you can refer to for different json examples.

https://docs.saviyntcloud.com/bundle/REST-v23x/page/Content/Developers-Handbook.htm

 


Regards,
Sahil

Kumat
New Contributor
New Contributor

Thank you for your response sahil. Suggested JSON didn't work.  Below is the screenshot of the sessionID. Basically session ID need to be replaced when ever a provisioning job is run.

This is how i get the session ID.

 

Kumat_0-1679974636625.png

When i click on send i get the sessionID as below.

 

{
"responseStatus": "SUCCESS",
"sessionId": "468735623856932EAA020202042948925952835059E44A523D115AD5220",
"userId": 1234567,
"vaultIds": [
{
"id": 12345,
"name": "My Laptop",
"url": "https://google.com/api"
}
],
"vaultId": 111111
}

I need to the take the session ID and replace in the below call. 

 

Kumat_2-1679974811662.png

and need to add the query to get the user and entitlement data in the result. When i click send i get user and entitlement data.

Kumat_3-1679974845266.png

 

So, Based on username and password and then SessionID with the query i need to build the JSON.

Please help me with a sample JSON which can handle this scenario in the connection. 

Again as said Session ID will expire every 24 hours.

Thank you in advance.

 

 

SB
Saviynt Employee
Saviynt Employee

Can you confirm the error you see in the logs. Also do ensure to update ConfigJSON param in the REST connection with value {"showLogs":true} before running the job.

Please share the log thread.


Regards,
Sahil