Sections ▾

POST ​/api​/triggers​/:token​/:event_name

Accepts JSON structured data from external services and sends though ContextHub as an event. This event is not authenticated, so you do not need to send your app uuid, and device id in the headers. However, the :token section of the url MUST match one of the triggers created in the ContextHub Developer Portal

Lets say you’ve created a trigger called ‘MyTrigger’ and it has a token of 123. You want to sent your computer’s uptime to ContextHub.

  
  curl -X POST "https://app.contexthub.com/api/triggers/123/uptime" \
       -H "Content-Type: application/json" \
       -d $'{\n"time": "8:28",\n"up": "2 days, 28 mins",\n"users": 12,\n"load_averages": [1.57, 1.70, 1.70]\n}' \
       -m 30 \
       -v \

 

After POSTing that data to the server, the following event will be delivered to your appropriate context rule.

  
  {
    "created_at": "2014-07-11T08:39:41-05:00",
    "id": "feb8bd4b-ec7f-4dff-b11e-7540dda8618d",
    "name": "uptime",
    "data": {
      "time": "8:28",
      "up": "2 days, 28 mins",
      "users": 12,
      "load_averages": [
        1.57,
        1.7,
        1.7
      ]
    },
    "context": {
      "trigger": "Trigger[MyTrigger]:123"
    },
    "payload": {
    }
  }
  

Request

Example Request

{
}

Example Parameters

This endpoint accepts any valid JSON

Response

Example Response

{
  "id": "698b479a-16e3-4c55-abd8-18a6e8a2a165"
}

Response Parameters

Response Codes

Successful Response Codes

Failure Response Codes