Search code examples
jsonhttp-postlogicyahoo-apisnaplogic

SnapLogic REST Post with JSON data


How do you make a REST Post in SnapLogic with JSON data as the body?

I need to make a Post to yahoo bulk file download endpoint (https://api.admanager.yahoo.com/v1/rest/bulk/download) and the request body has to be in JSON format:

{
  "advertiserId": 30944,
  "objectType": "CAMPAIGN",
  "downloadAllLevels": true,
  "filters": {
             "objectIds": [123,
                456
             ],
             "objectStatus": [
                "ACTIVE"
             ],
             "fromDate": "2014-07-01 00:00:00",
             "toDate": "2014-07-10 00:00:00",
                         "includeNegative":true,
                         "includeTargeting":true,
                         "includeExtensions":true
  }
}

Solution

  • To accomplish this you need to add a JSON Generator object and add your JSON data there.

    Then you can attach it to the REST Post object. In the Post object make sure the HTTP entity value is set to $ ($ = the root path) or whatever the path is to the JSON data that you want to send.

    JsonGenerator

    The post will now be sent with this json data as the body