and more in a single search tool across platforms. Read the announcement here. |
01/03/2024 07:40 AM
We have a requirement to integrate the MasterControl application with Saviynt, which is REST API based. One point to notice is that the application's API supports passing the parameter in the body of the request. Therefore, we constructed our connection JSON and passed the parameters in the HTTP Param variable. Please refer to the JSON below, which we are using.
Upon making a test connection, we encountered the following error. Do you see any issues causing the error?
"responseTextMap of testConnectionRest: [error:[message:can't cast String [] to a value of type [struct], type:expression]]"
01/03/2024 07:47 AM
@suryavav : Are you sure that your authentication call is GET call instead of POST call? Can you please share the Postman screenshot of your authentication call?
01/03/2024 07:57 AM
Authentication call is successful through postman and getting a result.
01/03/2024 08:05 AM
@suryavav : Try below JSON
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GET",
"httpParams": {
"arguments": {
"apiKey": "********************************************",
"logoutCurrentWebConnection": false
},
"methodName": "connectWithApiKey",
"serviceName": "ConnectionService"
},
"httpHeaders": {
"Content-Type": "text/plain"
},
"authError": [
"InvalidAuthenticationToken"
],
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [],
"successResponsePath": "",
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}
01/03/2024 09:08 AM
I tried and still getting the same error.
"2024-01-03T17:01:11.440+00:00","ecm","rest.RestProvisioningService","http-nio-8080-exec-177-rbvzc","DEBUG","responseTextMap of testConnectionRest: [error:[message:can't cast String [] to a value of type [struct], type:expression]]"
01/03/2024 09:18 AM - edited 01/03/2024 09:18 AM
01/03/2024 10:01 AM
Yes, correct it holds the token.
01/03/2024 01:19 PM
@suryavav : Then change
"tokenResponsePath": "access_token",
to and try
"tokenResponsePath": "result",
If it is still not working please share the postman screenshot for the call you making in testConnectionParams
01/03/2024 07:20 PM
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GET",
"httpParams": {
"arguments": {
"apiKey": "********************************************",
"logoutCurrentWebConnection": false
},
"methodName": "connectWithApiKey",
"serviceName": "ConnectionService"
},
"httpHeaders": {
"Accept": "text/plain",
"Content-Type": "application/json"
},
"httpContentType": "application/json",
"authError": [
"InvalidAuthenticationToken"
],
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "result",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponse": [
200
],
"successResponsePath": "result",
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error"
}
}
}
}
01/04/2024 12:17 AM - edited 01/04/2024 12:18 AM
I tried using the recently shared JSON and still getting same error response. As instructed, I tried to call the parameters in "testConnectionParam" where I kept body blank and getting same error response from the target.
Is the issue related to passing the parameters in 'httpparama'? I'm unsure if the syntax used to pass them in 'httpparamas' is correct. Do you see any issue because of this?
01/04/2024 06:53 AM
01/04/2024 07:04 AM
I added the 'testconnectionparams' attribute just to validate the connection JSON upon saving the connection. As we observed, Saviynt not log the authentication response and will not be printed in the logs. Removing that from the connection JSON should also be fine.
Do you see any way to print if access token generated successfully or not upon test connection?
01/04/2024 07:50 AM
@suryavav : As you mentioned testConnectionParams block will help you to validate if token is generated successfully and working for any subsequent calls. So to make sure that in testConnectionParams block you have to use any GET call (instead of login /authentication call) for example may be a call you use to pull accounts/users/entitlements anything. If you used the same kind of calls please share the postman output of respective call and respective headers or body you passed for that call.
01/04/2024 08:42 AM
Sorry for misunderstanding. Yes, through postman that call is successful and able to retrieve the accounts.
01/04/2024 09:32 AM
@suryavav : Try below JSON
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GET",
"httpParams": {
"arguments": {
"apiKey": "********************************************",
"logoutCurrentWebConnection": false
},
"methodName": "connectWithApiKey",
"serviceName": "ConnectionService"
},
"httpHeaders": {
"Content-Type": "text/plain"
},
"authError": [
"InvalidAuthenticationToken"
],
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "result",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************.cfm",
"httpParams": {
"arguments": {
"connectionID": "********************************************"
},
"methodName": "getAllUsers",
"serviceName": "UserService"
},
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GET"
},
"successResponses": {
"statusCode": [200]
},
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error.message"
}
}
}
}
01/04/2024 07:56 PM
Please share curl command [Refer https://codingnconcepts.com/postman/how-to-generate-curl-command-from-postman/ ]
01/04/2024 11:43 PM
Curl Command details.
01/05/2024 09:22 AM
@suryavav : I forgot to change method as GETWITHBODY in testConnectionParams. Please use below JSON
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GET",
"httpParams": {
"arguments": {
"apiKey": "********************************************",
"logoutCurrentWebConnection": false
},
"methodName": "connectWithApiKey",
"serviceName": "ConnectionService"
},
"httpHeaders": {
"Content-Type": "text/plain"
},
"authError": [
"InvalidAuthenticationToken"
],
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "result",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************.cfm",
"httpParams": {
"arguments": {
"connectionID": "********************************************"
},
"methodName": "getAllUsers",
"serviceName": "UserService"
},
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GETWITHBODY"
},
"successResponses": {
"statusCode": [200]
},
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error.message"
}
}
}
}
01/04/2024 11:32 PM
I tried it through the recent provided JSON where kept "connectionID": "${access_token}"
The connection ID here is the generated token that we expect to generate through the connection call. but still getting same error. Also, we also noticed that in the log when calling the web service URL, it shows square brackets despite providing curly brackets in JSON. However, our expectation is to see curly brackets, as using square brackets didn't work through Postman, and the expected format is with curly brackets.
I also wanted to bring to your attention that if we select 'No Auth' in the authorization through Postman, we will receive the expected response in both cases: when generating a connection ID (token) and when importing the account through utilizing the connectionID
01/05/2024 12:31 AM
Hi Surya,
In case you want to send Body params using a GET call, You need to use GETWITHBODY. Can you please try the below JSON and update.
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GETWITHBODY",
"httpParams": {
"arguments": {
"apiKey": "********************************************",
"logoutCurrentWebConnection": false
},
"methodName": "connectWithApiKey",
"serviceName": "ConnectionService"
},
"httpHeaders": {
"Content-Type": "text/plain"
},
"authError": [
"InvalidAuthenticationToken"
],
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "result",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************.cfm",
"httpParams": {
"arguments": {
"connectionID": "********************************************"
},
"methodName": "getAllUsers",
"serviceName": "UserService"
},
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GETWITHBODY"
},
"successResponses": {
"statusCode": [
200
]
},
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error.message"
}
}
}
}
01/05/2024 09:43 AM
@sk @rushikeshvartak I tried it using GETWITHBODY and getting below error, which usually receive response from application if provided invalid connection ID or pass null.
responseText:{"result":{"message":"Error: You do not have a valid connection",
01/10/2024 02:10 AM
@sk @rushikeshvartak Any update please. We are still facing the issue.
01/10/2024 11:23 PM
Please try once with below JSON.
{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"url": "https://***********",
"httpMethod": "GETWITHBODY",
"httpParams": "{\"arguments\":{\"apiKey\": \"********************************************\",\"logoutCurrentWebConnection\": false},\"methodName\": \"connectWithApiKey\",\"serviceName\": \"ConnectionService\"}",
"httpHeaders": {
"Content-Type": "text/plain"
},
"authError": [
"InvalidAuthenticationToken"
],
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "result",
"tokenType": "Bearer",
"retryFailureStatusCode": [
401,
403
],
"accessToken": "Bearer <token>",
"testConnectionParams": {
"http": {
"url": "https://****************************.cfm",
"httpParams": "{\"arguments\":{\"connectionID\": \"********************************************\"},\"methodName\": \"getAllUsers\",\"serviceName\": \"UserService\"}",
"httpHeaders": {
"Authorization": "${access_token}"
},
"httpContentType": "application/json",
"httpMethod": "GETWITHBODY"
},
"successResponses": {
"statusCode": [
200
]
},
"errors": [
"Couldn't authenticate you"
],
"errorPath": "error.message"
}
}
}
}
03/27/2024 03:23 AM
Hi @suryavav , We also have the similar use case were you able to resolve it?