Announcing the Saviynt Knowledge Exchange unifying the Saviynt forums, documentation, training,
and more in a single search tool across platforms. Read the announcement here.

Multiple API calls for REST connector in createAccountJson

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 21 2021 at 08:52 UTC

Hi All,


We have a requirement for REST application integration where need perform a post call(Call1) to fetch some value then make an use of that value in subsequent post call (call2) and we wanted to perform both the call in createAccountJSON.


below is the JSON detail:

{

"call": [

{

"name": "call1",

"connection": "userAuth",

"url": "https://abinbevwwdev.service-now.com/api/now/v1/table/sys_user?sysparm_query=sso_sourceISNOTEMPTY&sy...",

"httpMethod": "GET",

"httpParams": "",

"httpHeaders": {

"Authorization": "${access_token}"

},

"httpContentType": "application/json",

"ticketidPath": "result[0].sys_id",

"successResponses": {

        "statusCode": [

          200,

          201

        ]

      }

},

{

"name": "call2",

"connection": "userAuth",

"url": "https://abinbevwwdev.service-now.com/api/sn_sc/servicecatalog/items/3d33a369db835090faa711494b961985...",

"httpMethod": "POST",

"httpParams": "{\"sysparm_quantity\": \"1\",\"variables\": {\"u_requester\": \"${response.message.result[0].sys_id}\",\"u_on_behalf_of\": \"{response.message.result[0].sys_id}\",\"u_phone_number\": \"+91 9998877665\",\"u_location\":\"Bengaluru\",\"line_manager\":\"{response.message.result[0].sys_id}\",\"u_employee_zone\": \"55ccca0f1bfb00104aae202a2d4bcbb5\",\"action\": \"request_for_new_joiner\",\"first_name\": \"${user.firstname}\",\"last_name\": \"${user.lastname}\",\"line_managers_name\": \"${user.manager}\",\"line_managers_email_address\": \"${manager.email}\",\"employee_type\": \"non_abi_employee_external_user\",\"u_employee_designation\": \"white_collar\"}}",

"httpHeaders": {

"Authorization": "${access_token}"

},

"httpContentType": "application/json",

"ticketidPath": "result.cart_id",

"successResponses": {

        "statusCode": [

          200,

          201

        ]

      }

}

]

}


Regards,

Ashish

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.
4 REPLIES 4

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 21 2021 at 17:05 UTC

Ashish,


Could you elaborate your question further,I'm not able to understand what exactly you are trying to do.




Regards,

Avinash Chhetri

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 22 2021 at 04:40 UTC

Hi Avinash,

We are trying to call multiple Rest APIs in CreateticketJSON for ServiceNow Rest connection where the call1 response will be used by call2. so, chain them together in the createaccountjson is not working.

 


 

In the JOSN shared above u_requester attribute value I am trying to populate from call1.


Thanks,

Ashish

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 22 2021 at 14:26 UTC

Ashish,


You can try using response.call1.message instead of response.message when retrieving the informaton in call2.




Regards,

Avinash Chhetri


This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.

Community_User
Saviynt Employee
Saviynt Employee
Originally posted on September 27 2021 at 14:48 UTC

Hi Avinash,


This works. Thanks for the solution.


Regards,

Ashish

This message was previously posted on Saviynt's legacy forum by a community user and has been moved over to this forum for continued exposure.