Click HERE to see how Saviynt Intelligence is transforming the industry. |
09/04/2023 01:06 AM - last edited on 09/04/2023 02:08 AM by Sunil
Hi ,
I am receiving error in Create ticket JSON in Rest Connector . I am trying to create REQ in SNOW from Saviynt. Below is the JSON I am trying for. Please help me to resolve this.
JSON:
{ "call": [
{ "name": "call1",
"connection": "userAuth",
"url": "https://service-now.com/api/sn_sc/servicecatalog/items/SYSID/order_now ",
"httpMethod": "POST",
"httpParams": "{\"sysparm_quantity\": \"1\",\"get_portal_messages\": \"true\",\"variables\":{\"Application\":\"${endpoint}\",\"user_id\": \"${user.username}\",\"Action\": \"${if(task.tasktype==1){'Add'}else if(task.tasktype==2){'Delete Account'}else if(task.tasktype==2){'Remove Account'}else if(task.tasktype==3){'New Account'}else if(task.tasktype==6){'Enable Account'}else if(task.tasktype==14){'Suspend'}else{task.tasktype}}\",\"first_name\": \"${user.firstname}\",\"last_name\": \"${user.lastname}\",\"effective_date\": \"${user.customproperty8}\",\"entitlement\": \"${allEntitlementsValues}\"}}",
"httpHeaders": { "Authorization": "${access_token}" },
"httpContentType": "application/json",
"ticketidPath": "result.request_number",
"ticketStatusPath": "result.state",
"ticketStatusValue": ["Open", "OPEN", "open"],
"successResponses": { "statusCode": [200,201] }
}
]
}
I am getting error as Mandatory Variables are reqired
[This message has been edited by moderator to disable hyperlink to a url]
Solved! Go to Solution.
09/04/2023 01:49 AM - last edited on 09/04/2023 02:08 AM by Sunil
This pertains to a case-sensitive matter where "Application" and 'Action" under the "variables" should be in lowercase.
Corrected JSON:
{ "call": [
{ "name": "call1",
"connection": "userAuth",
"url": "https://service-now.com/api/sn_sc/servicecatalog/items/SYSID/order_now ",
"httpMethod": "POST",
"httpParams": "{\"sysparm_quantity\": \"1\",\"get_portal_messages\": \"true\",\"variables\":{\"application\":\"${endpoint}\",\"user_id\": \"${user.username}\",\"action\": \"${if(task.tasktype==1){'Add'}else if(task.tasktype==2){'Delete Account'}else if(task.tasktype==2){'Remove Account'}else if(task.tasktype==3){'New Account'}else if(task.tasktype==6){'Enable Account'}else if(task.tasktype==14){'Suspend'}else{task.tasktype}}\",\"first_name\": \"${user.firstname}\",\"last_name\": \"${user.lastname}\",\"effective_date\": \"${user.customproperty8}\",\"entitlement\": \"${allEntitlementsValues}\"}}",
"httpHeaders": { "Authorization": "${access_token}" },
"httpContentType": "application/json",
"ticketidPath": "result.request_number",
"ticketStatusPath": "result.state",
"ticketStatusValue": ["Open", "OPEN", "open"],
"successResponses": { "statusCode": [200,201] }
}
]
}