API design guide from heroku
JSON
*/internal_api/*
Accept: application/json; version=2
{
"items": []
}
Range: name; max=10, order=desc, offset=20;
Fields: id, name, description;
=>
{
"id": 1234,
"name": "Wer liefert was",
"description": "Search like a pro"
}
{
"error_type": "image_not_found",
"message": "Image with the ID 123 could not be found."
}
/internal_api/products?company_id=123&category_id=234
PUT /internal_api/product_images/123/actions/process
client = WlwApi::Client.create(:products)
client.get('/products').body
=>
{
items: [{
id: 123,
name: 'Flux capacitor'
}]
}
begin
client.get('/products/404')
rescue WlwApi::Error::NotFoundError => error
error.error_type
end
client.raw_get('/sap/resource').body
=> "... "
WlwApi::Test::Helper.json_response(200, some: 'body')
WlwApi::Test::Helper.api_exception(404, error_type: 'image_not_found')