Internal API usage at
Wer liefert was

Wer liefert was

  • Established 1932
  • Suplier search engine
  • 200 employees
  • 20 web developers
  • 20 SAP developers

Moving to the web

 

Breaking the Monolith

  • 10+ Apps
  • REST APIs
  • AMQP messages

Internal API from scratch

API design guide from heroku

Format

JSON

URL Namespace

*/internal_api/*

Versioning

Accept: application/json; version=2

Lists


{
  "items": []
}
					

Pagination

Range: name; max=10, order=desc, offset=20;

Fields

Fields: id, name, description;

=>


{
  "id": 1234,
  "name": "Wer liefert was",
  "description": "Search like a pro"
}
				  

Error Format


{
  "error_type": "image_not_found",
  "message": "Image with the ID 123 could not be found."
}
					

Filters


						/internal_api/products?company_id=123&category_id=234
					

Actions


						PUT /internal_api/product_images/123/actions/process
					

Documentation

  • Confluence (wiki)
  • api.md
  • ...

Library Support


client = WlwApi::Client.create(:products)
client.get('/products').body
=>
{
  items: [{
    id: 123,
    name: 'Flux capacitor'
  }]
}
					

Error handling


begin
  client.get('/products/404')
rescue WlwApi::Error::NotFoundError => error
  error.error_type
end
					

XML calls


client.raw_get('/sap/resource').body
=> "..."
					

Testing


WlwApi::Test::Helper.json_response(200, some: 'body')
WlwApi::Test::Helper.api_exception(404, error_type: 'image_not_found')
					

Thanks