Sections ▾

POST ​/api​/events

Receives a new event to be processed by the contextual service.

  
  curl -X POST "https://app.contexthub.com/api/events" \
       -H "Content-Type: application/json" \
       -H "Authorization: Token token=\"534e565f-335a-469d-974e-e18a85f00d2d\"" \
       -H "CONTEXTHUB_DEVICE_ID: DB4E6157-D64F-43EE-B114-39A13D2B9BC7" \
       -d $'{"event": {\n  "name": "location_changed",\n  "data": {\n    "course": -1,\n    "speed": -1,\n    "longitude": -95.46172896703202,\n    "device_id": "D659384E-078C-4365-B5AE-F594FACE6F1D",\n    "latitude": 29.76344397288731,\n    "horizontal_accuracy": 65,\n    "vertical_accuracy": 10,\n    "altitude": 10.96917343139648\n  },\n  "context": {\n    "location_context": {\n      "location": {\n        "course": -1,\n        "speed": -1,\n        "longitude": -95.46172896703202,\n        "device_id": "D659384E-078C-4365-B5AE-F594FACE6F1D",\n        "latitude": 29.76344397288731,\n        "horizontal_accuracy": 65,\n        "vertical_accuracy": 10,\n        "altitude": 10.96917343139648\n      },\n      "geofences": [\n        {\n          "id": "6677",\n          "latitude": 29.763194,\n          "longitude": -95.46174,\n          "radius": 250\n        }\n      ]\n    },\n    "triggered_at": "2014-12-08T11:37:12-06:00",\n    "device_context": {\n      "system_version": "8.1.1",\n      "device_id": "D659384E-078C-4365-B5AE-F594FACE6F1D",\n      "platform": "iPhone7,2",\n      "model": "iPhone",\n      "location_authorization": "authorized",\n      "type": "iPhone",\n      "name": "Not an FBI Surveillance Van",\n      "system_name": "iPhone OS"\n    }\n  },\n  "payload": {}\n}\n}' \
       -v \
  

Request

Example Request

{
  "event": {
    "name": "geofence_in",
    "data": {
      "altitude": "0",
      "course": -1,
      "datetime": "2013-11-01 16:13:03",
      "device_id": "F616E1CE-7A80-4C40-A20E-8DCF722C9BAD",
      "speed": "-1",
      "fence": {
        "id": 1,
        "latitude": 37,
        "longitude": -100.4,
        "radius": 10
      }
    },
    "context": {
    },
    "payload": {
    }
  }
}

Example Parameters

Response

Example Response

{
  "id": "848d074e-048a-4122-9462-af50ecc5cc33"
}

Response Parameters

Response Codes

Successful Response Codes

Failure Response Codes