Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RailsConf 2014 - Designing the APIs for an inte...

RailsConf 2014 - Designing the APIs for an internal set of services

The success of an API is measured by how fast and easy developers can integrate with that.

In the micro-services environment, where each service has a well-defined responsibility, it's not enough to have a well designed API, it's necessary to establish a contract between the APIs, so the integration between them may be feasible.

Avatar for Alberto Leal

Alberto Leal

April 24, 2014
Tweet

More Decks by Alberto Leal

Other Decks in Programming

Transcript

  1. " A concept where an application is decomposed into small

    and loosely coupled services, where each service has a single responsibility, running in its own process.
  2. Resource POST (create) GET (read) PUT (replace) PATCH (update) DELETE

    (delete) /cars new car list all cars new car or error error delete all cars /cars/123 error show car 123 update car or error modify car or error delete car 123
  3. HTTP/1.1 400 Bad Request ! ! { "errorCode" : 123,

    "moreInfo": “http://dev.api.com/errors/123" "errors": [ { "name": [ “can’t be blank" ] } ] } use http status code payload as verbose as possible
  4. 400 - 401 - 403 - 404 - 500 Bad

    Request Forbidden Unauthorized Not Found Internal Server Error
  5. " A concept where an application is decomposed into small

    and loosely coupled services, where each service has a single responsibility, running in its own process.
  6. { "title": "App", "type": "object", "properties": { "name": { "type":

    "string", "title": "Name" }, "uris": { "type": "array", "title":"URIs", "items": { "type": "string" } } }, "required": ["name"] } required fields
  7. { "links": [ { "href": "https://domain/apps", "method": "POST", "rel": “create”,

    "schema": { "$ref": "https://domain/schemas/apps/new_app" } } … ] }