Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

Multiple API calls for REST connector (create account)

sushmita
Regular Contributor
Regular Contributor

Hello,

 

  • We need to create an account in service now (part of joiner workflow)
  • The account needs to be populated with department, manager and building attributes which are actually referenced as sys_id in the client’s service now instance
  • I saw a post on the saviynt forums which mentioned using 2 calls in the CreateAccountJson field to achieve this, but I wasn’t able to. Maybe it’s a format issue? The status of task is 'completed' on the UI but we don't see any data in service now. When we only use a single call to create account, that works fine. I don't see any errors in the logs either. 
  • I have pasted  the CreateAccountJson below. Could you please let me know if I am missing something? 
{
  "accountIdPath": "call1.message.result.sys_id",
  "responseColsToPropsMap": {},
  "call": [
  {
      "name": "call1",
      "connection": "acctAuth",
      "httpMethod": "POST",
      "httpParams": "{\"sysparm_query\":\"name%3D${user.departmentname}\",\"sysparm_fields\":\"sys_id\" }",
      "httpHeaders": {
        "Authorization": "${access_token}"
      },
      "httpContentType": "application/json",
      "successResponses": {
        "statusCode": [
          200,
          201
        ]
      }
    },
{
            "name": "call0",
      "connection": "acctAuth",
      "httpMethod": "POST",
       "httpParams":"{\"email\":\"${user.email}\",\"first_name\":\"${user.firstname}\",\"last_name\":\"${user.lastname}\",\"employee_number\":\"${user.username}\",\"title\":\"${user.title}\",\"department\":\"${response.call1.result.sys_id}\",\"active\":\"${user.status}\"}",
      "httpHeaders": {
        "Authorization": "${access_token}"
 },
      "httpContentType": "application/json",
      "unsuccessResponses":
        {
          "error.message": "Operation Failed"
        }
    }
  ]
}
6 REPLIES 6

rushikeshvartak
All-Star
All-Star

callOrder": 0,
"stageNumber": 0

are missing 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

https://saviynt.freshdesk.com/support/solutions/articles/43000521736-rest-connector-guide 


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

sushmita
Regular Contributor
Regular Contributor

Is this before call0 or call1?

sushmita
Regular Contributor
Regular Contributor

Just went through the guide, I don't see these variables listed for CreateAccountJSON..could you tell me where you got this from?

{
	"accountIdPath": "call2.message.id",
	"call": [{
			"name": "call1",
			"connection": "accAuth",
			"url": "https://uri.rushi.com",
			"httpMethod": "POST",
			"httpParams": "{\"username\": \"${user.customproperty22}\", \"firstName\": \"${user.firstname}\", \"lastName\": \"${user.lastname}\",\"email\": \"${user.customproperty22}\",\"enabled\":\"true\"}",
			"httpHeaders": {
				"Authorization": "${access_token}"
			},
			"httpContentType": "application/json",
			"successResponses": {
				"statusCode": [201, 200, 204]
			},
			"unsuccessResponses": {
				"statusCode": [400, 403, 401, 404, 409, 501, 500]
			}
		},
		{
			"name": "call2",
			"connection": "accAuth",
			"url": "https://uri.rushi.com?max=-1",
			"httpMethod": "GET",
			"httpParams": "",
			"httpHeaders": {
				"Authorization": "${access_token}"
			},
			"httpContentType": "application/json"
		}	
		
	]
}

Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

sushmita
Regular Contributor
Regular Contributor

Thank you, will try this format out.