Hi guys,
I am trying to setup a data action that is able to create an external contact.
HTTP Method: POST
Request URL Template: /api/v2/externalcontacts/contacts
Request Body Template:
{ "firstName": "${input.First_Name}", "lastName": "${input.Last_Name}", "workPhone": { "display": "${input.Phone_Work}" }, "cellPhone": { "display": "${input.Phone_Mobile}" }, "address": { "address1": "${input.Address_Street}", "city": "${input.Address_City}", "countryCode": "${input.Address_CountryCode}" } }
=> When I run a test I get an error about an unexpected condition:
Execute: The server encountered an unexpected condition which prevented it from fulfilling the request.
REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"HTTP 415 Unsupported Media Type","code":"unsupported media type","status":415,"contextId":"3967ff8e-7d0e-4dcd-8092-75448ab253e8","details":[],"errors":[]} [3ea83bbe-e3a1-4e17-b2a8-f229854ebb4f]
The last green check is at "Resolve request body template":
"{ \"firstName\": \"123\", \"lastName\": \"123\", \"workPhone\": { \"display\": \"+49123456\" }, \"cellPhone\": { \"display\": \"+49123456\" }, \"address\": { \"address1\": \"123\", \"city\": \"123\", \"countryCode\": \"DE\" } }"
At "Execute" I get the error:
{
"message": "The server encountered an unexpected condition which prevented it from fulfilling the request.",
"code": "internal.server.error",
"status": 500,
"messageParams": {},
"contextId": "3ea83bbe-e3a1-4e17-b2a8-f229854ebb4f",
"details": [
{
"errorCode": "ACTION.REMOTE_ENDPOINT"
}
],
"errors": [
{
"message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\"message\":\"HTTP 415 Unsupported Media Type\",\"code\":\"unsupported media type\",\"status\":415,\"contextId\":\"3967ff8e-7d0e-4dcd-8092-75448ab253e8\",\"details\":[],\"errors\":[]} [3ea83bbe-e3a1-4e17-b2a8-f229854ebb4f]",
"code": "INTERNAL_SERVER_ERROR",
"status": 415,
"messageParams": {},
"details": [],
"errors": []
}
]
}
I've copied the data from "Resolve request body template" to the API Explorer (without the " at the beginning and at the end) and it was working fine.
The external contact "123, 123" was created without any problem.
The complete data action as JSON looks like this:
{
"requestType": "POST",
"requestTemplate": "{ \"firstName\": \"${input.First_Name}\", \"lastName\": \"${input.Last_Name}\", \"workPhone\": { \"display\": \"${input.Phone_Work}\" }, \"cellPhone\": { \"display\": \"${input.Phone_Mobile}\" }, \"address\": { \"address1\": \"${input.Address_Street}\", \"city\": \"${input.Address_City}\", \"countryCode\": \"${input.Address_CountryCode}\" } }",
"requestUrlTemplate": "/api/v2/externalcontacts/contacts",
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"UserAgent": "PureCloudIntegrations/1.0"
}
}
Does anybody see my mistake?
THANKS!!!
BR, Robert
#DataActions#PlatformAPI