Click HERE to see how Saviynt Intelligence is transforming the industry. |
12/11/2023 03:43 AM
We are using Rest API connection to import the users from Servicenow. Sometimes job is failing to import the new users which are added in servicenow tabe and sometimes updates are not being reconciled for the exisiting users as well.
please find the connection JSON we are using. Please suggest
12/11/2023 03:45 AM
@SaiKiran Please share the logs and import json
12/11/2023 04:42 AM
Hi Sumathi,
Thanks for the reply. Please find the below import JSON.
{
"connection": "userAuth",
"url":
"httpMethod": "GET",
"httpHeaders": {
"contentType": "application/json",
"Authorization": "${access_token}"
},
"colsToPropsMap": {
"username": "u_number~#~char",
..................
},
"errorCode": "400",
"errorCodePath": "errorCode",
"userResponsePath": "result",
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
}
12/11/2023 10:23 AM
try below json for import
{
"accountParams": {
"connection": "userAuth",
"processingType": "SequentialAndIterative",
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://<domain name>/api/now/table/sys_user?sysparm_limit=100",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/x-www-form-urlencoded",
"httpMethod": "GET"
},
"statusConfig": {
"active": "true",
"inactive": "false"
},
"listField": "result",
"keyField": "accountID",
"colsToPropsMap": {
"customproperty1": "employee_number~#~char",
"CUSTOMPROPERTY2": "last_name~#~char",
"customproperty3": "name~#~char",
"CUSTOMPROPERTY4": "first_name~#~char",
"CUSTOMPROPERTY5": "department~#~char",
"CUSTOMPROPERTY6": "location~#~char",
"CUSTOMPROPERTY7": "email~#~char",
"CUSTOMPROPERTY8": "manager~#~char",
"CUSTOMPROPERTY9": "country~#~char",
"CUSTOMPROPERTY10": "phone~#~char",
"CUSTOMPROPERTY11": "title~#~char",
"name": "user_name~#~char",
"status": "active~#~char",
"accountID": "sys_id~#~char"
},
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
}
}
},
"entitlementParams": {
"processingType": "SequentialAndIterative",
"entTypes": {
"Group": {
"entTypeOrder": 0,
"entTypeLabels": {},
"call": {
"call1": {
"connection": "userAuth",
"callOrder": 0,
"stageNumber": 0,
"http": {
"httpHeaders": {
"Authorization": "${access_token}"
},
"url": "https://<domain name>/api/now/table/sys_user_group",
"httpContentType": "application/json",
"httpMethod": "GET"
},
"statusConfig": {
"active": "true",
"inactive": "false"
},
"listField": "result",
"keyField": "entitlementID",
"colsToPropsMap": {
"entitlementID": "sys_id~#~char",
"description": "description~#~char",
"entitlement_value": "name~#~char",
"displayname": "name~#~char",
"status": "active~#~char",
"updatedate": "sys_updated_on~#~char"
}
}
},
"entMappings": {
"Group": {
"listPath": "parent",
"idPath": "value",
"idColumn": "entitlementID",
"mappingTypes": [
"ENTMAP"
]
}
}
},
"Roles": {
"entTypeOrder": 1,
"entTypeLabels": {},
"call": {
"call1": {
"connection": "userAuth",
"callOrder": 0,
"stageNumber": 0,
"http": {
"httpHeaders": {
"Authorization": "${access_token}"
},
"url": "https://<domain name>/api/now/table/sys_user_role",
"httpContentType": "application/json",
"httpMethod": "GET"
},
"listField": "result",
"keyField": "entitlementID",
"colsToPropsMap": {
"description": "description~#~char",
"customproperty3": "elevated_privilege~#~char",
"entitlementID": "sys_id~#~char",
"entitlement_Value": "name~#~char",
"displayname": "sys_name~#~char"
}
}
}
}
}
},
"acctEntParams": {
"entTypes": {
"Group": {
"call": {
"call1": {
"connection": "userAuth",
"processingType": "http",
"http": {
"url": "https://<domain name>/api/now/v1/table/sys_user_grmember?sysparm_limit=10000",
"httpContentType": "application/json",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
}
},
"listField": "result",
"acctKeyField": "accountID",
"entKeyField": "entitlementID",
"acctIdPath": "user.value",
"entIdPath": "group.value",
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
}
}
},
"Roles": {
"call": {
"call1": {
"connection": "userAuth",
"processingType": "http",
"http": {
"url": "https://<domain name>/api/now/table/sys_user_has_role?sysparm_limit=10000",
"httpContentType": "application/json",
"httpMethod": "GET",
"httpHeaders": {
"Authorization": "${access_token}"
}
},
"listField": "result",
"acctKeyField": "accountID",
"entKeyField": "entitlementID",
"acctIdPath": "user.value",
"entIdPath": "role.value",
"pagination": {
"nextUrl": {
"nextUrlPath": "${headers?.Link?.split(';')?.size()==5?headers?.Link?.split(';')[2]?.replace('rel=\"prev\",<', '')?.replace('>','')?.trim():headers?.Link?.split(';')?.size()==4 && headers?.Link?.split(';')[2].contains('rel=\"next\",<')?headers?.Link?.split(';')[1]?.replace('rel=\"first\",<', '')?.replace('>','')?.trim():null}"
}
}
}
}
}
}
}
}
12/11/2023 05:15 AM - edited 12/11/2023 05:16 AM
@SaiKiran Please try with below connectionJSON-Auth type basic
{
"authentications":{
"userAuth":{
"authType":"Basic",
"url":"https://XXXXXXXXXXXXX.service-now.com/",
"httpMethod":"POST",
"httpParams":{
},
"httpHeaders":{
"contentType":"application/x-www-form-urlencoded"
},
"httpContentType":"text/html",
"properties":{
"userName":"XXXXXXXXXXX",
"password":"XXXXXXXXXX"
},
"expiryError":"ExpiredAuthenticationToken",
"authError":[
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"timeOutError":"Read timed out",
"errorPath":"error.code",
"maxRefreshTryCount":5,
"tokenResponsePath":"access_token",
"tokenType":"Basic",
"accessToken":"Basic <Token>"
}
}
}
Also share the error logs