Overview

You can use this request to add contacts to a Dynamic Data Set workflow.

The Method

API-Method
RESTPOSThttps://[Your URL]/api/3.0/workflows/data-set/subscribe

Parameters

PropertyTypeDescriptionRequired
workflow_idintegerThe ID of the Workflow you want to add the contacts to. This can be found by hovering over the checkbox of the Workflow on the Workflow History page.yes
contact_emailstringIf you use this option, the contact will be found using their email address. If more than one contact exists with this email address, use the other field.no
contact_unique_idstringUse this field if you want to select the contact using their unique ID. You can set this field to whatever you like.no
contact_mobilestringIf you use this option, the contact will be found using their mobile number. If more than one contact exists with this number, use the other field.
Workflow dataset fieldsRefer to documentation on workflow data set fields.

Example Request

The following is a code sample for the request:

<?php
$client = new http\Client;
$request = new http\Client\Request;
$request->setRequestUrl(‘[your-url]/api/3.0/workflows/data-set/subscribe');
$request->setRequestMethod('POST');
$body = new http\Message\Body;
$body->append('{
    "workflow_id": 41,
    "contact_email":  "[email protected]",
    "dsv_41_flight_number": "poo",
    "dsv_41_flight_date": "2020-12-31",
    "dsv_41_test_departure_airport": “JFK”
}');
$request->setBody($body);
$request->setOptions(array());
$request->setHeaders(array(
  'Authorization' => 'Basic =',
  'Content-Type' => 'application/json',
  'Authorization' => 'Basic =',
  'Content-Type' => 'text/plain'
));
$client->enqueue($request)->send();
$response = $client->getResponse();
echo $response->getBody();

Example Response

Success Result: 

{
    "result":"success",
    "data":{
       "workflow_id":"32",
       "workflow_contact_mapping_id":10
  }
}


Error Results


Workflow not found
{
    "result":"error",
    "data":”Workflow does not exist”
}

Workflow not active
{
    "result":"error",
    "data":” Workflow is not active”
}

Workflow not dataset
{
    "result":"error",
    "data":” Workflow is not a dataset workflow”
}

Dataset validation errors

{
    "result":"error",
    "data": {
       "messages":[
          "dsv_41_flight_number invalid whole number",
          “dsv_41_departure_date is a required fields”
       ]
    }
}

Error no contact found

{
      "result":"error",
   "data":{"messages":["A contact with the given email address\/mobile number or unique id was not
found"]}}