Create Trigger

Create a new trigger on a Datastream.

Notes:

  • The Location parameter in the response header will contain the “TRIGGER_ID” that is automatically generated by Xively on successful trigger creation.
  • The data for a trigger read can only be encoded as xml or json, not csv.

A full list of trigger parameters is available on the API Resource Attributes page.

Request

Parameters
Method POST
Base URL https://api.xively.com
API Endpoint /v2/triggers
Headers
X-ApiKey API_KEY_HERE
Body
JSON
XML
CSV
  • POST/v2/triggers.json

    {
      "url":"http://requestb.in/131tsul1",
      "trigger_type":"lt",
      "threshold_value":"15.0",
      "environment_id":121601,
      "stream_id":"example"
    }
    
  • POST/v2/triggers.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <datastream-trigger>
      <url>http://requestb.in/131tsul1</url>
      <trigger-type>lt</trigger-type>
      <threshold-value type="float">15.0</threshold-value>
      <environment-id type="integer">121601</environment-id>
      <stream-id>example</stream-id>
    </datastream-trigger>
    
  • CSV format not available for this call.
    

Response

Parameters
Status Code 201 CREATED
Headers
Location https://api.xively.com/v2/triggers/TRIGGER_ID
Body
JSON
XML
CSV
  • This response does not return body data
    
  • This response does not return body data
    
  • CSV format not available for this call