Using the REST API in an External System

Octave provides a REST API consisting of Octave objects (e.g. Device, Event, etc.) that you can invoke from an external system to push data into Octave.

The API's Event Object for example, includes endpoints to create, manage, and find events.

The following example shows how the POST /{company ID}/event/{stream ID} endpoint can be used to post an event with a single key/value (measure) to a stream:

Request

curl -X "POST" "https://octave-api.sierrawireless.io/v5.0/my_company/event/s5b7310ae6f38613585853e5b" \
     -H 'X-Auth-Token: <token>' \
     -H 'X-Auth-User: <user>' \
     -d $'{
  "elems": {
    "measure": 7
  }
}'

Response

The messages field in the response indicates the result of the request and the id indicates the ID of the event that was added:

{
   "head":{
      "status":201,
      "ok":true,
      "messages":[
         "Your request has been processed successfully. A new resource has been created."
      ],
      "errors":[

      ],
      "references":{

      }
   },
   "body":{
      "id":"e5b7311856f38613585853e61",
      "streamId":"s5b7310ae6f38613585853e5b",
      "creationDate":1534267781805,
      "generatedDate":1534267781805,
      "path":"/my_company/streamname",
      "version":0,
      "elems":{
         "measure":7
      }
   }
}