Announcing the SAVIYNT KNOWLEDGE EXCHANGE unifying the Saviynt forums, documentation, training, and more in a single search tool across platforms. Click HERE to read the Announcement.

REST based connector using apikey

JB
Regular Contributor
Regular Contributor

Hello All,

Anyone have a sample for REST Connector connection Json with authentication using apikey ?

It will be helpful since I couldn't find any sample from FD using just apikey.

Best Regards,

Jithin B

4 REPLIES 4

sagars
Saviynt Employee
Saviynt Employee

Hello @JB ,

Please some of the sample JSON below

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"contentType": "application/json"
},
"authError": [
"InvalidAuthenticationToken",
"AuthenticationFailed"
],
"url": "<api url>",
"httpMethod": "POST",
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"authHeaderName": "apikey",
"accessToken": "XXXXXXXXX",
"retryFailureStatusCode": []
}
}
}

{
"authentications": {
"acctAuth": {
"authType": "oauth2",
"httpHeaders": {
"contentType": "application/json"
},
"authError": [
"Invalid credentials",
"AuthenticationFailed"
],
"url": "https://cloud.tenable.com",
"httpMethod": "POST",
"httpContentType": "application/json",
"errorPath": "error.code",
"maxRefreshTryCount": 5,
"tokenResponsePath": "access_token",
"authHeaderName": "X-ApiKeys",
"accessToken": "accessKey=53XXXXXX;secretKey=814fXXXX",
"httpParams": "[object Object]",
"retryFailuRESTatusCode": []
}
}
}

Regards,
Sagar Srikantaiah

amit_krishnajit
Saviynt Employee
Saviynt Employee

Here is a sample JSON

{
	"authentications": {
		"userAuth": {
			"authType": "oauth2",
			"url": "https://example.org/sample",
			"httpMethod": "POST",
			"httpParams": {},
			"httpHeaders": {
				"contentType": "application/x-www-form-urlencoded"
			},
			"httpContentType": "application/x-www-form-urlencoded",
			"expiryError": "ExpiredAuthenticationToken",
			"authError": [
				"InvalidAuthenticationToken",
				"AuthenticationFailed",
				"FAILURE",
				"INVALID_SESSION_ID"
			],
			"timeOutError": "Read timed out",
			"errorPath": "errors.type",
			"maxRefreshTryCount": 5,
			"tokenResponsePath": "sessionId",
			"tokenType": "Bearer",
			"accessToken": "Key asd321SAN83A7jsad2P012S"
		}
	}
}
Thanks,
Amit

JB
Regular Contributor
Regular Contributor

Hello All,

Thanks for your valuable help.

I am using below Create account Jsons and trying to provision but getting below mentioned error. Any insight on this ?
==============================================================
{
"call":[
{
"name":"call1",
"connection":"acctAuth",
"url":"https:/sample.testURL",
"httpMethod":"POST",
"httpParams":"{\"ActionId\": \"99ca5754-73b2-4e58-8c11-b1a5ac891ce8\",\"ShouldSave\":true,\"ActionParams\": {\"GridParams\": {\"actionId\": \"99ca5754-73b2-4e58-8c11-b1a5ac891ce8\",\"recordIds\": [\"RecordId\": \"7FCDA50C376442EEA50C49FA2EE4D446\",\"ObjectType\": \"Task#Assignment\"]}},\"FormParams\":null,\"PromptParams\":null}",
"httpHeaders":{
"contentType":"application/json",
"Authorization":"rest_api_key=wertyuuuuuuuuuuutest3404DA711A002184957AF"
},
"successResponses":{
"statusCode":[
200,
201
]
}
}
]
}
==============================================================
Error Message:
"call1":{"message":"Unexpected character (':' (code 58)): was expecting comma to separate Array entries\n at [Source: {\"ActionId\": \"99ca5754-73b2-4e58-8c11-b1a5ac891ce8\",\"ShouldSave\":true,\"ActionParams\": {\"GridParams\": {\"actionId\": \"99ca5754-73b2-4e58-8c11-b1a5ac891ce8\",\"recordIds\": [\"RecordId\": \"7FCDA50C376442EEA50C49FA2EE4D446\",\"ObjectType\": \"Task#Assignment\"]}},\"FormParams\":null,\"PromptParams\":null}; line: 1, column: 179]","status":"Failed"}}

==============================================================

Regards,

Jithin B

Looks like the value for recordIds in the JSON should be an array, however what you are passing is another JSON.

Thanks,
Amit