Saviynt unveils its cutting-edge Intelligence Suite products to revolutionize Identity Security!
Click HERE to see how Saviynt Intelligence is transforming the industry.
Saviynt Copilot Icon

importJson for API key authentication for REST Connector not returning data

DG1811
New Contributor III
New Contributor III

Hi All,

We have a REST connector based application integration, where we have tried connecting the application using the below JSON and is was resolved with Connection Successful update.

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"Authentication": "xxxxxxxxxxxxxxxxxxxx",
"Accept": "application/json"
},
"authError": [
"USER_AUTHENTICATION_FAILED",
"PARTNER_AUTHENTICATION_FAILED",
"AuthenticationFailed"
],
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxx",
"httpMethod": "GET",
"httpContentType": "application/json",
"errorPath": "errorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "",
"tokenType": "Bearer",
"authHeaderName": "",
"accessToken": "bearerabc",
"retryFailureStatusCode": [
401,
403
]
}
}
}

But while we try to pull the data using the below importjson, it did not work. Although the job is showing success, but the results are not coming up.

IMPORTJSON

{
"accountParams": {
"connection": "acctAuth",
"processingType": "SequentialAndIterative",
"includeExistingInActiveAccounts": true,
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://XXXXXXXXXXXXXXXXXXXXXXXXXX",
"httpHeaders": {
"Authentication": "XXXXXXXXXXXXXXXXXXXXXX",
"Accept": "application/json"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"keyField": "accountID",
"colsToPropsMap": {
"accountID": "id~#~char",
"name": "id~#~char",
"displayName": "name~#~char",
"customproperty1": "id~#~char",
"customproperty2": "name~#~char",
"customproperty3": "email~#~char",
"customproperty4": "application~#~char"
}
}
}
}
}

 

But when we run the GET command in the POSTMAN it gives us proper response as we shared with you. 

Please find the response format of the data, whereas we are just pulling id, name, email and application attribute as of now.

{
"id": "xxxxx",
"name": "xxxx",
"email": "xxxxxxxx",
"application": "xxxxx",
"entitlements": [
{
"id": "xxxx"
},
{
"id": "xxxxx"
}
]
}

Request you to please suggest some ways to pull the data. Also please verify if the importjson needs some update.

Also please find the attached log for reference.

Please find the new thread. 

Thanks

[This message has been edited by moderator to merge reply comment]

12 REPLIES 12

rushikeshvartak
All-Star
All-Star

{
"accountParams": {
"connection": "acctAuth",
"processingType": "SequentialAndIterative",
"includeExistingInActiveAccounts": true,
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://XXXXXXXXXXXXXXXXXXXXXXXXXX",
"httpHeaders": {
"Authorization": "Bearer ${accessToken}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"keyField": "id",
"colsToPropsMap": {
"id": "accountID~#~char",
"name": "displayName~#~char",
"email": "customproperty3~#~char",
"application": "customproperty4~#~char"
}
}
}
}
}

 

 
 

Key changes and points to consider:

  1. Authorization Header: Changed Authentication to Authorization with a dynamic reference to the accessToken.
  2. KeyField: Ensure the keyField is correctly set to "id".
  3. Columns Mapping: Verify the colsToPropsMap is correctly mapping response fields to Saviynt attributes.

Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak ,

Thanks for the update. I have checked it, but please not while we pass Authorization as a header for teh API , it gives 401 , as per the app team we need to pass Authentication as a header name. 

I checked the details as suggested by you, and also passed the API key in the access token, but it did not work.

It gave 401 error.

Below are the error lines:

 

2024-07-01T22:59:32+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-3-z9v9b-DEBUG-Got Webservice API Response: [headers:[Date: Mon, 01 Jul 2024 17:29:32 GMT, Content-Length: 0, Connection: keep-alive, X-Content-Type-Options: nosniff, X-XSS-Protection: 1; mode=block, Cache-Control: no-cache, no-store, max-age=0, must-revalidate, Pragma: no-cache, Expires: 0, Strict-Transport-Security: max-age=31536000 ; includeSubDomains, X-Frame-Options: DENY, WWW-Authenticate: Bearer], responseText:, cookies:[], statusCode:401]
 
2024-07-01T22:59:32+05:30-ecm-worker-rest.RestUtilService-quartzScheduler_Worker-3-z9v9b-DEBUG-pullObjectsByRest - responseStatusCode ::401
 
2024-07-01T22:59:32+05:30-ecm-worker-rest.RestProvisioningService-quartzScheduler_Worker-3-z9v9b-ERROR-Exception in pullObjectsByRest :401
 
Please suggest.
Thanks

Pass both Authentication and Authorization


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

DG1811
New Contributor III
New Contributor III

Hi @rushikeshvartak ,

Same out put, this is what we are trying.

 

ConnectionJSOn:

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"Accept": "application/json",
"Authentication": "xxxxxxxxxxkeyxxxxxxxx"
},
"authError": [
"USER_AUTHENTICATION_FAILED",
"PARTNER_AUTHENTICATION_FAILED",
"AuthenticationFailed"
],
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"httpMethod": "GET",
"httpContentType": "application/json",
"errorPath": "errorCode",
"maxRefreshTryCount": 5,
"tokenResponsePath": "",
"tokenType": "Bearer",
"authHeaderName": "",
"accessToken": "abc",
"retryFailureStatusCode": [
401,
403
]
}
}
}

 

 

Importjson

{
"accountParams": {
"connection": "acctAuth",
"processingType": "SequentialAndIterative",
"includeExistingInActiveAccounts": true,
"call": {
"call1": {
"callOrder": 0,
"stageNumber": 0,
"http": {
"url": "https://xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"httpHeaders": {
"Authentication": "xxxxxxxxxxxxxxxkeyxxxxxxxxxxxxxxxxxxxxxxxx",
"Authorization": "Bearer ${accessToken}",
"Accept": "application/json"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"keyField": "id",
"colsToPropsMap": {
"id": "accountID~#~char",
"name": "displayName~#~char",
"email": "customproperty3~#~char",
"application": "customproperty4~#~char"
}
}
}
}
}

 

 

Still the job goes into error state. And its the same error that comes up. If i try to pass in postman also with both the Authentication and Authorization, it throws me 401.

Attaching postman output for reference.

Please suggest. 

Thanks

GET is not supported in Connection JSON . Use GETWITHBODY


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

hI @rushikeshvartak ,

No change, same response, the job fails with an error same as the earlier. Please suggest.

Thanks

Please share postman screenshot and curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
⚠️‼️‼️Do not upload any attachments that contain sensitive information, such as IP Addresses, URLs, Company/Employee Names, Email Addresses, etc.‼️‼️⚠️


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak ,

Please find the attached postman screenshot update. 

Thanks

DG1811
New Contributor III
New Contributor III

Hi @rushikeshvartak ,

Any update from your end?

Thanks and appreciate your help on this. 

We have also requested the App team if we can modify the header name to Authorization for the API, but that is not possible it seems. 

Authorization is supported Authentication method by Saviynt. Please get it updated by App team


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.

Hi @rushikeshvartak ,

Can you please share any reference document concluding this, so that we can share it with the App team as a reference.

Thanks

Refer https://docs.saviyntcloud.com/bundle/Dev-Handbook-REST-v24x/page/Content/Developers-Handbook.htm


Regards,
Rushikesh Vartak
If this helped you move forward, click 'Kudos'. If it solved your query, select 'Accept As Solution'.