Job Writer: HTTP/S
DataZen allows you to forward data into an HTTP/S endpoint. Select an existing HTTP/s connection to see the HTTP/S target options. You can specify two separate HTTP requests (an Upsert and a Delete operation).
When building an HTTP/S request, specify the HTTP Verb, the Content-Type and the HTTP URI to call. The Max Batch Count controls the number of calls made to the HTTP/S endpoint in parallel; however, if you send a JSON or XML array as a payload, this setting controls how many records are included in the array and the endpoint is called once per batch of records.
You can use DataZen functions to format the HTTP URI and the payload HTTP Payload being sent. For example, if the HTTP URI is a REST endpoint and the URI expects two variables (list_id and contact_id) found as part of the data, the URI would look like this:
/lists/{{list_id}}/members/{{contact_id}}
HTTP Example 1
This example shows you how to build a PUT request, one record at a time from the Change Log.
In this example, the source data is sent (one record at a time) to a target
endpoint with the root URI specified by the selected Target System.
The source data is expected to have the following three columns:
list_id, contact_id, and email. These fields are used as part of the
request URI and in the payload of the request.
In addition, the option to continue on error 400 ensures that if for some reason the URI
rejects one call, the job will continue to try the remaining records. If this option is
left blank, the job will stop on the first error.
The Max Batch Count setting is important; since we are building one payload per record, the max count should be set to 1.
HTTP Example 2
This example shows you how to build a PUT request, taking up to 1,000 records at a time from the Change Log, and build a JSON array with the batch of data. This example shows you how to write to a Google Sheet.
The source data is expected to have the following three columns: list_id, contact_id, and email. The payload is a JSON string.
In this example, the payload may contain up to 1,000 records, and the JSON document is built using the @concatjsonarr function.
Sending a JSON Array
Since the target system accepts an array of JSON documents, you can use the Generate JSON/XML Document link to build the array. In this case, the number of items in the array will be controlled by the Max Batch Count setting. Use the @concatjson function to send an array of objects and @concatjsonarr to send an array of values.
{ "range": "A@startindex", "majorDimension": "ROWS", "values": [@concatjsonarr(["{{id}}", "{{email_address}}", "{{full_name}}", "{{status}}"])] }
If the target endpoint needs an XML payload, use the @concatxml or @concatxmlarr functions instead.