http://resthooks.herokuapp.com/
All requests must contain HTTP_AUTHORIZATION header with "Token token="USER-TOKEN-PREVIOUSLY-PROVIDED""
There are two main resources. They are called Beers and burgers, and both have a deliciousness field.
All examples will use beers. For burgers, please replace beers and use burgers instead.
You can create beers by posting to /api/v1/beers with the following payload:
{
"beer": {
"deliciousness": 3
}
}
curl "http://localhost/api/v1/beers" \
-H 'Accept: application/json' -H 'Content-type: application/json' \
-H "Authorization: Token token=TOKEN-HERE" \
-X POST \
-d '{
"beer": {
"deliciousness": 3
}
}'
You can update them by putting to /api/v1/beers/ID with the following payload:
{
"beer": {
"deliciousness": 4
}
}
curl "http://localhost/api/v1/beers/1" \
-H 'Accept: application/json' -H 'Content-type: application/json' \
-H "Authorization: Token token=TOKEN-HERE" \
-X PUT \
-d '{
"beer": {
"deliciousness": 4
}
}'
So now you've got beers and burgers, your service can be subscribed to receive updates when they get modified/created/destroyed.
You need to post to /api/v1/resource_subscriptions (user token in header)
{
"resource_subscription": {
"post_url": "https://example.com/some_hook?user_id=123",
"authentication": null,
"version": 1,
"resource": "beer"
}
}
curl "http://localhost/api/v1/resource_subscriptions
-H 'Accept: application/json' -H 'Content-type: application/json' \
-H "Authorization: Token token=TOKEN-HERE" \
-X PUT \
-d '{
"resource_subscription": {
"post_url": "https://example.com/some_hook?user_id=123",
"authentication": null,
"version": 1,
"resource": "beer"
}
}'
MIT 2013.