Forum Discussion

shawnharv's avatar
shawnharv
New Contributor
5 years ago

JSON Payload issues

I’ve come across an issue where the REST post works using a JSON generator, but when we receive the JSON from the pipeline and post it, the call fails. The JSON payload is exactly the same between the JSON generator and what we receive, yet we cannot get the POST call to fire successfully.

JSON Payloads is as follows:
[
{
“kind”: “doubleclicksearch#conversionList”,
“conversion” : [{
“clickId” : “XXXXXXXXXXXXXXXXXXMYaAunkEALw_wcB”,
“conversionId” : “XXXXXXXXXXXzhXE5AAM”,
“conversionTimestamp” : “1623361621000”,
“segmentationType” : “FLOODLIGHT”,
“segmentationName” : “SFDC_Wins”,
“type”: “ACTION”
},
{
“clickId” : “XXXXXXXXXXXXd69532af3081b22f4”,
“conversionId” : “XXXXXXXXXXXXXzhW2pAAE”,
“conversionTimestamp” : “1623352858000”,
“segmentationType” : “FLOODLIGHT”,
“segmentationName” : “SFDC_Wins”,
“type”: “ACTION”
}
]
}
]

4 Replies

  • bojanvelevski's avatar
    bojanvelevski
    Valued Contributor

    Hi @shawnharv,

    Try and wrap the payload into one object, and pass that object into the Entity field in the REST Post snap.

    Something like this:

    [
    {
    “payload”: {
    “kind”: “doubleclicksearch#conversionList”,
    “conversion”: [
    {
    “clickId”: “XXXXXXXXXXXXXXXXXXMYaAunkEALw_wcB”,
    “conversionId”: “XXXXXXXXXXXzhXE5AAM”,
    “conversionTimestamp”: “1623361621000”,
    “segmentationType”: “FLOODLIGHT”,
    “segmentationName”: “SFDC_Wins”,
    “type”: “ACTION”
    },
    {
    “clickId”: “XXXXXXXXXXXXd69532af3081b22f4”,
    “conversionId”: “XXXXXXXXXXXXXzhW2pAAE”,
    “conversionTimestamp”: “1623352858000”,
    “segmentationType”: “FLOODLIGHT”,
    “segmentationName”: “SFDC_Wins”,
    “type”: “ACTION”
    }
    ]
    }
    }
    ]

    Don’t forget the Content-Type Header:

    • shawnharv's avatar
      shawnharv
      New Contributor

      Thanks [bojanvelevski] for the quick response.

      I tried wrapping this in the payload object like you suggested, but still no success. The doubleclick search API responds with “The request was not valid. Details: [Empty batch encountered]”.

      Its very strange how the payload works when its coming from a JSON generator snap, but the same JSON payload coming from a file fails. The two are literally the same haha.

      Thanks,
      Shawn

      • ptaylor's avatar
        ptaylor
        Employee

        Please review and post a screenshot of the Pipeline Execution Statistics of each version of the pipeline – the one with the JSON Generator and the one without. This will give us more information about exactly how many input documents are being received by the REST Post.