Streaming via RESTful Events API
Real-Time Streaming Events API Documentation
The full Events API documentation can be found at https://initialstateeventsapi.docs.apiary.io/# .
If you have any questions about the api, how to use it, or run into any issues, feel free to reach out or you can chat with us in the public-api-docs gitter chat room.
Create a Bucket |
Send Single Event to Bucket |
Sent Multiple Events to Bucket |
| Headers | iso8601 Timestamp | No Timestamp |
| URL Parameters | Epoch Timestamp | Epoch Timestamp |
| URL Parameters | URL Parameters |
API usage example using cURL:
If you don't have cURL installed, you can download it here: http://curl.haxx.se/download.html
Create a streaming Event Bucket
Headers
You can try this cURL command, just replace the X-IS-AccessKey header value with one from your account.
curl --include \ --request POST \ --header "Content-Type: application/json" \ --header "X-IS-AccessKey: YOUR_KEY" \ --header "Accept-Version: ~0" \ --data-binary "{ \"bucketKey\": \"curl_example_bucket\", \"bucketName\": \"cURL Example Bucket\" }" \ 'https://groker.initialstate.com/api/buckets'
No Headers
Or you can try this cURL command, just replace the accessKey parameter valuewith one from your account.
curl --request POST 'https://groker.initialstate.com/api/buckets?accessKey=YOUR_KEY&bucketKey=curl_example_bucket&bucketName=cURL%20Example%20Bucket'
Send events to the Bucket
iso8601 Timestamp
You can try this cURL command, just replace the X-IS-AccessKey header value with one from your account. In this example, the timestamp is specified in iso8601.
curl --include \ --request POST \ --header "Content-Type: application/json" \ --header "X-IS-AccessKey: YOUR_KEY" \ --header "X-IS-BucketKey: curl_example_bucket" \ --header "Accept-Version: ~0" \ --data-binary "[ { \"iso8601\": \"2015-10-08T07:54+06:00\", \"key\": \"temperature\", \"value\": \"25.4\" } ]" \ 'https://groker.initialstate.com/api/events'
Epoch Timestamp
Or you can try this cURL command, just replace the X-IS-AccessKey header valuewith one from your account. In this example, the timestamp is specified in epoch.
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "X-IS-AccessKey: YOUR_KEY" \
--header "X-IS-BucketKey: curl_example_bucket" \
--header "Accept-Version: ~0" \
--data-binary "[
{
\"epoch\": 1444309192,
\"key\": \"temperature\",
\"value\": \"27.8\"
}
]" \
'https://groker.initialstate.com/api/events'
No Headers
Or you can try this cURL command, just replace the accessKey parameter value with one from your account.
curl --request POST 'https://groker.initialstate.com/api/events?accessKey=YOUR_KEY&bucketKey=curl_example_bucket&temperature=25.4'
Send multiple events to the Bucket
No Timestamp
You can try this cURL command, just replace the X-IS-AccessKey header value with one from your account. In this example, no timestamp is specified so the server will provide the timestamp when it is received.
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "X-IS-AccessKey: YOUR_KEY" \
--header "X-IS-BucketKey: curl_example_bucket" \
--header "Accept-Version: ~0" \
--data-binary "[
{
\"key\": \"temperature\",
\"value\": \"22.2\"
},
{
\"key\": \"power\",
\"value\": \"6\"
},
{
\"key\": \"status\",
\"value\": \":thumbsup:\"
},
{
\"key\": \"current\",
\"value\": \"156\"
},
{
\"key\": \"door\",
\"value\": \"open\"
}
]" \
'https://groker.initialstate.com/api/events'
Epoch Timestamp
Or you can try this cURL command, just replace the X-IS-AccessKey header value with one from your account. In this example, the timestamp is specified in epoch.
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "X-IS-AccessKey: YOUR_KEY" \
--header "X-IS-BucketKey: curl_example_bucket" \
--header "Accept-Version: ~0" \
--data-binary "[
{
\"epoch\": 1444309192,
\"key\": \"temperature\",
\"value\": \"22.2\"
},
{
\"epoch\": 1444310192,
\"key\": \"temperature\",
\"value\": \"23.2\"
},
{
\"epoch\": 1444311192,
\"key\": \"temperature\",
\"value\": \"22.7\"
}
]" \
'https://groker.initialstate.com/api/events'
No Headers
Or you can try this cURL command, just replace the accessKey parameter value with one from your account.
curl --request POST 'https://groker.initialstate.com/api/events?accessKey=YOUR_KEY&bucketKey=curl_example_bucket&temperature=22.2&power=6&status=:thumbs_up:¤t=156&door=open'