Skip to content

Custom events in scenarios – API methods 

Thanks to the API, you can automate the addition of custom events data used in scenarios. The available method for these actions is POST. 

POST method – adding custom events to scenarios #

To send a query using this method, you need the following information: 

  1. Server address (endpoint): https://api.ecdp.app/scenariocustomevents 
  1. Parameters
Parameter Type Category Description 
x-api-key String header your API key, which you can find in Settings > API 
customEventId* integer($int32) body custom event ID number 

Other parameters you can add to your query: 

Parameter Type Max character countDescription 
customerIdstringbodynumer ID klienta
customerEmail string  320customer email address
customerEmailMd5 string  32customer email address encrypted with the Md5 algorithm
customerEmailSha256 string  64customer email address encrypted with the Sha256 algorithm
customerPhone string  20customer telephone number
customerCrmId string  128customer CRM ID number
dataFields   additional data describing the custom event; includes an additional set of parameters >>> see tables below 

The dataFields parameters have their own parameters that will allow you to add or obtain more detailed information. 

Parameter Type Description 
name string data name 
type string data type: String, Text, Number, Money, Date, DateTime, Boolean, URL 
value string data value 

API query syntax for the POST method 

Below, you’ll find sample syntax for adding custom events to your scenario: 

{
  "customEventId": 0,
  "customerId": 0,
  "customerEmail": "string",
  "customerEmailMd5": "string",
  "customerEmailSha256": "string",
  "customerPhone": "string",
  "customerCrmId": "string",
  "dataFields": [
    {
      "name": "string",
      "type": "String",
      "value": "string"
    }
  ]
}

POST query response codes

201: Created

The request has been created.

400: Bad request

The request has not been processed, the reason is usually a missing or invalid parameter. 

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "errors": [
    "string"
  ]
}

401: Unauthorized

The request was missing an API key or you are requesting access to information that you do not have permission to access.

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}

404: Not found

The data you are looking for is not on the server.

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string"
}

POST method – adding customers in segments to scenarios

To send a query using this method, you need the following information:

  1. Server address (endpoint): https://api.ecdp.app/scenariocustomevents/withsegments
  2. Parameters:
Parameter Type Category Description 
x-api-key String header your API key, which you can find in Settings > API 
customEventId* integer($int32) body custom event ID number 
segments*integer($int32) bodysegment ID

Other parameters you can add to your query:

Parameter Type Description 
name string data name 
type string data type: String, Text, Number, Money, Date, DateTime, Boolean, URL 
value string data value 

API query syntax for the POST method

Below you’ll find sample syntax for adding customers to an active scenario base on segments with ID numbers: 1, 5 and 15.

{
  "customEventId": 0,
  "segments": [
    0
  ],
  "dataFields": [
    {
      "name": "string",
      "type": "String",
      "value": "string"
    }
  ]
}

POST query response codes

201: Created

The request has been created.

400: Bad request

The request has not been processed, the reason is typically a missing or invalid parameter. 

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "substatus": "CustomerInvalidModelState",
  "detail": "string",
  "instance": "string",
  "errors": [
    "string"
  ]

401: Unauthorized

The request was missing an API key or you are requesting access to information that you do not have permission to access.

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "substatus": "CustomerInvalidModelState",
  "detail": "string",
  "instance": "string"
}

404: Not found

The data you are looking for is not on the server.

Sample response syntax: 

{
  "type": "string",
  "title": "string",
  "status": 0,
  "substatus": "CustomerInvalidModelState",
  "detail": "string",
  "instance": "string"
}