Legacy Dev Forum Posts

 View Only

Sign Up

'Malformed syntax' POST Data Action

  • 1.  'Malformed syntax' POST Data Action

    Posted 06-05-2025 18:43

    carlos.camacho | 2022-01-31 20:07:44 UTC | #1

    Hi guys,

    I am trying to create a custom data action, but I am having some problem with its execution, or rather, with the "Request Body Template".

    The data action attacks a URL of an external web service, and uses the POST method, as I can assure you that it uses HTTPS.

    Data Action JSON Format

    { "requestUrlTemplate": "https://xxxxxxx.com/services/rest/connect/v1.3/analyticsReportResults", "requestType": "POST", "headers": { "contentType": "application/json", }, "requestTemplate":"{ "id":108314"} }

    The "Request Body Template" should be the following:

    { "id":108314 }

    However, when I run a "test" on the draft data action, it returns the following error:

    { "message": "The request could not be understood by the server due to malformed syntax.", "code": "bad.request", "status": 400, "messageParams": {}, "contextId": "dbf8d187-2097-444a-88b3-81993940eee1", "details": { "errorCode": "ACTION.REMOTE_ENDPOINT". } ], "errors": [ { "message": "REST call for action execute failed. Message:Request to backend service failed. Response from web service: { "type": \{ "https://xxxxxxx.com/services/rest/connect/exceptions/OSC-CREST-00011": \"Incorrect JSON syntax found in request",{"status": 400,{"detail": \"JSON (JavaScript object notation) is a lightweight, text-based, language-independent data interchange format. It is defined by IETF RFC 7159, which can be found at the following address: [https://tools. ietf. org/html/rfc7159. The request made violates JSON syntax rules, so the request cannot be read. Correct the syntax errors and retry the request.\",\"instance": \"https://xxxxxxx.com/services/rest/connect/v1.3/analyticsReportResults",\"o:errorCode": \"OSC-CREST-00011\"\n}\n [dbf8d187-2097-444a-88b3-81993940eee1]", "code": "BAD_REQUEST", "status": 400, "messageParams": {}, "details": [], "errors": [] } ] }

    We have tried absolutely everything, adding headers indicating that the Content-Type is application/json, the Accept-Encoding is gzip, deflate, br, modifying the input and output contracts, and we have not been able to get this data action to execute. At all times it points to a problem of bad syntax formation in the request body template.

    To know if it is a Genesys Cloud problem we have launched this same thing with Postman and the result has been satisfactory and the same URL is used, the same request body template, same credentials... So the point of failure is in Genesys Cloud.

    Response in Postman:

    { { "count": 19, }, "name": "dateSystemCorrect", { "columnNames": [ "date" ], "rows": [ [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ], [ "2022-01-31T16:22:27+01:00" ] ], [ "links": [ { "rel": [ "self", "href": "https://xxxxxxx.com/services/rest/connect/v1.3/analyticsReportResults" }, { }, "rel": "canonical", }, { "href": "https://xxxxxxx.com/services/rest/connect/v1.3/analyticsReportResults" }, { }, "rel": "describedby", }, { "href": "https://xxxxxxx.com/services/rest/connect/v1.3/metadata-catalog/analyticsReportResults", "mediaType": "application/schema+json" } ] }

    Could you help me to find the problem?

    We look forward to your response. Thank you in advance.


    Jason_Mathison | 2022-01-31 20:17:49 UTC | #2

    Hi Carlos,

    Check out https://help.mypurecloud.com/articles/troubleshoot-the-data-actions-integrations/ select the "Web Services" tab and try out the first troubleshooting step, " Custom action fails for unexpected reason"

    --Jason


    carlos.camacho | 2022-02-01 06:27:58 UTC | #3

    Thank you very much Jason, I managed to solve the problem.

    Adding the header "Transfer-Encoding" to "buffered" works correctly.

    Thank you very much!


    system | 2022-03-04 06:28:25 UTC | #4

    This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 13389