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

REST Connector - Connection JSON

Saviynt_Savvy
Regular Contributor
Regular Contributor
Hi,
I made a Connection JSON in REST Connector.
I have the Postman collection from the client where the Parameters used are:

"grant_type": "client_credentials",
"client_secret": "xxxxxxxxxxxx",
"client_id": "xxxx"
I am using the below Connection JSON and getting the "Connection was Successful" message.

Connection JSON:
{
    "authentications": {
        "acctAuth": {
            "authType": "oauth2",
            "httpMethod": "POST",
            "httpParams": {
                "grant_type": "client_credentials",
                "client_secret": "xxxxxxxxxxxx",
                "client_id": "xxxx"
            },
            "httpHeaders": {
                "contentType": "application/x-www-form-urlencoded",
"grant_type": "client_credentials",
                "client_secret": "xxxxxxxxxxxxx",
                "client_id": "xxxx"
            },
            "httpContentType": "application/x-www-form-urlencoded",
            "expiryError": "ExpiredAuthenticationToken",
            "authError": [
                "InvalidAuthenticationToken"
            ],
            "retryFailureStatusCode": [
                401
            ],
            "timeOutError": "Read timed out",
            "errorPath": "error.code",
            "maxRefreshTryCount": 5,
            "tokenResponsePath": "access_token",
            "tokenType": "Bearer",
            "accessToken": "Bearer abcd"
        }
    }
}
 
But when I ran the Application Data Import Job, the job is failed and the error getting in the Job History Details is: 
"Error WebService call failed After retrying 5 times with responseStatusCode null".
Saviynt_Savvy_0-1714456259580.png
Any suggestions why the Import Job is failing ?

Thanks & Regards, 
SaviyntSavvy
8 REPLIES 8

naveenss
All-Star
All-Star

Hi @Saviynt_Savvy  Please try the below JSON. I have added the testConnectionParams. This will check whether your connection is actually working or not when you click on "Save and test Connection" Make sure to update the api details (GET call) to fetch values from the target app. 

 

Refer to the below REST developer handbook: https://docs.saviyntcloud.com/bundle/Dev-Handbook-REST-v24x/page/Content/Developers-Handbook.htm#imp... 

{
    "authentications": {
        "acctAuth": {
            "authType": "oauth2",
            "url": "https://192.xxx.xx.xx/phoenixapi/xxxxx/sandbox/connect/token",
            "httpMethod": "POST",
            "httpParams": {
                "grant_type": "client_credentials",
                "client_secret": "xxxxxxxxxxxx",
                "client_id": "xxxx"
            },
            "httpHeaders": {},
            "httpContentType": "application/x-www-form-urlencoded",
            "expiryError": "ExpiredAuthenticationToken",
            "authError": [
                "InvalidAuthenticationToken"
            ],
            "retryFailureStatusCode": [
                401
            ],
            "timeOutError": "Read timed out",
            "errorPath": "error.code",
            "maxRefreshTryCount": 5,
            "tokenResponsePath": "access_token",
            "tokenType": "Bearer",
            "accessToken": "Bearer abcd",
            "testConnectionParams": {
                "http": {
                    "url": "https://<domain name>/api/v2/users.json",
                    "httpHeaders": {
                        "Authorization": "${access_token}"
                    },
                    "httpContentType": "application/json",
                    "httpMethod": "GET"
                },
                "successResponse": [],
                "successResponsePath": "",
                "errors": [
                    "Couldn't authenticate you"
                ],
                "errorPath": "error"
            }
        }
    }
}

 

Regards,
Naveen Sakleshpur
If this reply answered your question, please click the Accept As Solution button to help future users who may have a similar problem.

rushikeshvartak
All-Star
All-Star

Resource is missing


{
"authentications": {
"userAuth": {
"authType": "oauth2",
"url": "https://login.microsoftonline.com/sssssssss/oauth2/token",
"httpMethod": "POST",
"httpParams": {
"grant_type": "client_credentials",
"client_secret": "******",
"client_id": "hjjjmmmmmmmmm",
"resource": "https://graph.microsoft.com"
},
"httpHeaders": {
"contentType": "application/x-www-form-urlencoded"
},
"httpContentType": "application/x-www-form-urlencoded",
"expiryError": "ExpiredAuthenticationToken",
"authError": [
"InvalidAuthenticationToken"
],
"retryFailureStatusCode": [
401
],
"timeOutError": "Read timed out",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"accessToken": "Bearer abc"
}
}
}


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

Hi @rushikeshvartak ,
Thanks for the reply.
Is the "resource" attribute a mandatory one?

Thanks & Regards,
SaviyntSavvy

Ignore post its for Azure.

Please share postman screenshot and Please share curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]


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

Hello @rushikeshvartak ,
Please find the Postman screenshot and the curl command below.

Saviynt_Savvy_0-1714634681077.png

Saviynt_Savvy_1-1714634731602.png




cURL code snippet:
curl --location 'https://abcd-xyz-01/phoenixapi/abcd/sandbox/Admin/Global/Employees/search' \
--header 'Accept: application/json'

Please let me know if required any further information.

Thanks & Regards,
SaviyntSavvy

check postman console to find parameters [ctrl+Shift+i]


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

Hi @rushikeshvartak ,

I also wanted to mention that the "client_secret" contains some special characters like "@","!","/","$" . 
client_secret: @xxxx!xxxx/xxxxx$xxx
Will these characters breaks the string in the Connection JSON's client secret? If yes, let me know how to escape these characters.

Thanks & Regards,
SaviyntSavvy

$ may break


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