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

Cuántas UXs tiene mi API

Sebastián Osorio
September 27, 2016

Cuántas UXs tiene mi API

A veces nos conformamos con tener una API que responda datos, pero no recordamos que lo que respondemos debe ser usado para la UX de nuestro sistema, o peor aún, que tenemos un API absurdamente difícil de usar.

Sebastián Osorio

September 27, 2016
Tweet

More Decks by Sebastián Osorio

Other Decks in Design

Transcript

  1. HTTP WEB API CLIENTS - Programmatic interface - One or

    more publicly exposed endpoint - Defined request-response message system
  2. HTTP Request POST /cars HTTP/1.1 Content-type: application/json space { "name":

    "Optimus Prime”, “plates”: “The-Boss" } Head Body
  3. HTTP Response HTTP/1.1 200 OK Content-type: application/json space { “id":

    1, "name": "Optimus Prime”, "plates": “The-Boss" } Head Body
  4. An API is a developer's UI Just like any UI,

    it's important to ensure the user's experience is thought out carefully
  5. REST https://www.ics.uci.edu/~fielding/pubs/dissertation/rest_arch_style.htm ‣ 1. Uniform Interface ‣ 2. Stateless Interactions

    ‣ 3. Cacheable ‣ 4. Client-Server ‣ 5. Layered System ‣ 6. Code on Demand Constrains
  6. HTTP API RESTful CLIENTS - Programmatic interface - One or

    more publicly exposed endpoint - Defined request-response message system - Implements REST architecture principles
  7. DO Resource POST create GET read PUT update DELETE delete

    /dogs Create a new dog List dogs Blue update dogs Delete all dogs /dogs/1234 Error Show 1234 If exist update 1234 If not error Delete bo
  8. DO

  9. DO

  10. Be Practical Use the most common HTTP status codes 2xx

    Success 200 OK 201 Created 204 No Content 4xx Client Error 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 409 Conflict 3xx Redirection 304 Not Modified 5xx Server Error 500 Internal Server Error
  11. DO

  12. DO { “error": { "name": "Error", "status": 401, "message": "Authorization

    Required", "statusCode": 401, "code": "AUTHORIZATION_REQUIRED", } }
  13. DO Handle custom codes { “error": { "name": “Invalid email",

    "message": “The email is not valid”, “code”: 40002 } }
  14. DO { "error": { "message": "Message describing the error", "type":

    "OAuthException", "code": 190, "error_subcode": 460, "error_user_title": "A title", "error_user_msg": "A message", "fbtrace_id": "EJplcsCHuLu" } } Handle custom codes: Facebook
  15. DO { { "type": "error", "status": 400, "code": "bad_request", "context_info":

    { "errors": [ { "reason": "expiration_not_allowed", "name": "unshared_at", "message": "Expiration cannot be set on a shared link with 'collaborators' access", "location": "entity-body" } ] }, "help_url": "https://box-content.readme.io/ reference#errors", "message": "Bad Request" } } Provide a Help URL
  16. Q&A