Legacy Dev Forum Posts

 View Only

Sign Up

Custom data action keep throwing 400 error code

  • 1.  Custom data action keep throwing 400 error code

    Posted 06-05-2025 18:40

    husseinco | 2018-08-01 12:46:56 UTC | #1

    Hi All,

    I have been trying to fetch data through Custom Data Action but I keep getting 400 status code indicating that "Cause: No results for path: $['Incidents']"

    Following is my Action config

    Input Contract { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "employeenumber" ], "properties": { "employeenumber": { "type": "integer" } } }

    Output contract { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "required": [ "Incidents" ], "properties": { "Incidents": { "type": "object" } } }

    Request config

    { "requestUrlTemplate": "https://Exmaple.service-now.com/api/Exmaple/showlastopenedtickets?EmpID=${input.employeenumber}", "requestType": "GET", "headers": { "Authorization": "Basic REDACTED" }, "requestTemplate": "${input.rawRequest}" }

    Response config

    { "translationMap": { "Incidents": "$.Incidents" }, "successTemplate": "{\r\n \t\"Tickets\": ${Incidents} }" }

    Any hint on what might be cause would be appreciated.

    My Action config file <a class="attachment" href="/forum/uploads/db6296/original/1X/66b7263c00828b5c6aa99c5d8f39f03ebef19474.json">GetLast5OpenedTickets-2018073115747.custom.json</a> (1.3 KB)


    Jason_Mathison | 2018-07-31 13:31:07 UTC | #2

    Looking at the execute results, it looks like your web service is returning a key of "Incidents: ", note that there is both a colon and space prior to the end quote.

    This JSONPath seems to work for that: $.'Incidents: '


    husseinco | 2018-07-31 14:11:23 UTC | #3

    @Jason_Mathison Thank you for your reply, I tried your suggestion but it threw the below error

    { "status": 500, "code": "internal.server.error", "message": "The server encountered an unexpected condition which prevented it from fulfilling the request.", "messageParams": {}, "contextId": "cb4c99ff-ec2e-4ec6-9739-89aa4a001e86", "details": [], "errors": [] }

    Response Config

    { "translationMap": { "Incidents": "$.'Incidents: '" }, "successTemplate": "{\"Tickets\" : ${Incidents}}" }


    Jason_Mathison | 2018-07-31 15:24:13 UTC | #4

    It turns out that our JSONPath interpreter requires square brackets [ ] around properties that contain blank characters. I was able to verify that the following works:

    { "translationMap": { "Incidents": "$.['Incidents: ']" }, "successTemplate": "{\"Tickets\" : ${Incidents}}" }

    I am also entering an issue to ensure that this error message makes it back to end-users so that they can fix this themselves.

    Finally, it looks like you included your authorization information in your request config. You should make sure that authentication is revoked / changed ASAP.


    husseinco | 2018-07-31 16:10:41 UTC | #5

    I tried the above snippet but I got the below error


    Jason_Mathison | 2018-07-31 17:16:09 UTC | #6

    Your output contract requires "Incidents", but your succcessTemplate is outputing "Tickets".


    husseinco | 2018-07-31 20:12:55 UTC | #7

    @Jason_Mathison

    I had to change the incident type from Object to string and word Tickets to Incidents in the successTemplate and it's working fine now, THANK YOU for your usual and great efforts.


    system | 2018-08-31 20:16:47 UTC | #8

    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: 3281