To create a data streamer of type REST API, a POST request should be sent to https://cdn.emnify.net/api/v1/data_stream.

The request body determines the data stream type and configuration. The following are example request bodies for API-type data streams:

Rest API

POST cdn.emnify.net/api/v1/data_stream:

{
  "stream_historic_data": 0,
  "data_stream_type": {
    "description": "Events",
    "id": 2
  },
  "api_type": {
    "description": "RestAPI",
    "id": 1
  },
  "api_callback": {
    "organisation_id": "1337",
    "url": "https://my-application-server.com/callback",
    "purpose": "Adding Alerts for failed auth attempts.",
    "id": 196
  }
}

Rest API Bulk

When the REST API option for the Data Streamer is set to Bulk Mode, data is sent in a JSON collection instead of individual events. The differentiator in the request body is the api_type object which has an id of 6.

POST cdn.emnify.net/api/v1/data_stream:

{
  "stream_historic_data": 1,
  "data_stream_type": {
    "description": "Usage Data",
    "id": 1
  },
  "api_type": {
    "description": "RestAPI (Bulk)",
    "id": 6
  },
  "api_callback": {
    "organisation_id": "1337",
    "url": "https://my-application-server.com/callback",
    "purpose": "Adding Alerts for failed auth attempts.",
    "id": 196
  }
}

For more information, see the /data_stream Swagger Reference.