for
DESIGNING THE APIS
an internal set of services
albertoleal
albertonb@gmail.com
https://github.com/globocom
for
DESIGNING THE
an internal
APIS
set of services
what is an API ?
micro-services
environment
"A concept where an application is
decomposed into small and loosely coupled
services, where each service has a single
res...
ad$
A
Evolving a service
search
accounts
video
images
No restriction
Maintainable
and
Stable
Replacement
test the services?
HOWTO
define services contract?
manage deployment?
How do we get started
with our
API?
API Modeling
API Modeling - Conceptual Model
purpose
audience
developer,developer, developer
Developer
as a
Customer
API
as a
Product
API Modeling - Ubiquitous Language
API Modeling
!
Do not reinvent
the wheel
HAL
JSON API
JSON Schema
…
what makes a great API?
is
flexible
and
simple to use
/cars?fields=name,model,year
/cars
uses
nouns
instead of
verbs
/collection/<resource><?filters>
/cars/123?fields=name,model,year
/cars
/cars?status=new
/cars/123
/getAllCars
/getAllNewCars
/getCar/123
uses
HTTP Verbs
to perform operations
on the elements
Resource
POST
(create)
GET
(read)
PUT
(replace)
PATCH
(update)
DELETE
(delete)
/cars new car list all cars
new car
or
erro...
returns meaningful errors
HTTP/1.1 400 Bad Request	
!
!
{	
"errorCode" : 123, 	
"moreInfo": “http://dev.api.com/errors/123"	
"errors": [	
{	
"name":...
400 - 401 - 403 - 404 - 500
Bad Request Forbidden
Unauthorized Not Found
Internal Server Error
provides great support
Documentation
Documentation
Documentation Communication
CommunityDocumentation Communication
is secure
what about versioning?
application/vnd.example.com+json; version=1
application/vnd.example.com.v1+json;
Accept:
test the services?
HOWTO
define services contract?
manage deployment?
ad$
A
contracts enable
service independence
but…
"A concept where an application is
decomposed into small and loosely coupled
services, where each service has a single
res...
Contracts can also
couple
service providers
and
consumers
{	
"title": "App",	
"type": "object",	
"properties": {	
"name": {	
"type": "string",	
"title": "Name"	
},	
"uris": {	
"typ...
{	
"links": [ 	
{	
"href": "https://domain/apps",	
"method": "POST",	
"rel": “create”,	
	 	 "schema": {	
	 	 	 	 	 "$ref":...
Consumer-Driven Contracts:
A Service Evolution Pattern
http://martinfowler.com/articles/consumerDrivenContracts.html
test the services?
HOWTO
define services contract?
manage deployment?
Deployment
imagessearch
Deployment
search
Deployment
test the services?
HOWTO
define services contract?
manage deployment?
Contract
Tests
Integration

Tests
be positive
thanks!
@albertoleal
albertonb@gmail.com
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Designing the APIs for an internal set of services
Upcoming SlideShare
Loading in …5
×

Designing the APIs for an internal set of services

140
-1

Published on

Desinging the APIs for an internal set of services

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
140
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Designing the APIs for an internal set of services

  1. 1. for DESIGNING THE APIS an internal set of services
  2. 2. albertoleal albertonb@gmail.com
  3. 3. https://github.com/globocom
  4. 4. for DESIGNING THE an internal APIS set of services
  5. 5. what is an API ?
  6. 6. micro-services environment
  7. 7. "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.
  8. 8. ad$ A
  9. 9. Evolving a service search accounts video images
  10. 10. No restriction
  11. 11. Maintainable and Stable
  12. 12. Replacement
  13. 13. test the services? HOWTO define services contract? manage deployment?
  14. 14. How do we get started with our API?
  15. 15. API Modeling
  16. 16. API Modeling - Conceptual Model
  17. 17. purpose
  18. 18. audience
  19. 19. developer,developer, developer
  20. 20. Developer as a Customer API as a Product
  21. 21. API Modeling - Ubiquitous Language
  22. 22. API Modeling
  23. 23. ! Do not reinvent the wheel HAL JSON API JSON Schema …
  24. 24. what makes a great API?
  25. 25. is flexible and simple to use
  26. 26. /cars?fields=name,model,year /cars
  27. 27. uses nouns instead of verbs
  28. 28. /collection/<resource><?filters> /cars/123?fields=name,model,year
  29. 29. /cars /cars?status=new /cars/123 /getAllCars /getAllNewCars /getCar/123
  30. 30. uses HTTP Verbs to perform operations on the elements
  31. 31. 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
  32. 32. returns meaningful errors
  33. 33. 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
  34. 34. 400 - 401 - 403 - 404 - 500 Bad Request Forbidden Unauthorized Not Found Internal Server Error
  35. 35. provides great support
  36. 36. Documentation
  37. 37. Documentation
  38. 38. Documentation Communication
  39. 39. CommunityDocumentation Communication
  40. 40. is secure
  41. 41. what about versioning?
  42. 42. application/vnd.example.com+json; version=1 application/vnd.example.com.v1+json; Accept:
  43. 43. test the services? HOWTO define services contract? manage deployment?
  44. 44. ad$ A
  45. 45. contracts enable service independence
  46. 46. but…
  47. 47. "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.
  48. 48. Contracts can also couple service providers and consumers
  49. 49. { "title": "App", "type": "object", "properties": { "name": { "type": "string", "title": "Name" }, "uris": { "type": "array", "title":"URIs", "items": { "type": "string" } } }, "required": ["name"] } required fields
  50. 50. { "links": [ { "href": "https://domain/apps", "method": "POST", "rel": “create”, "schema": { "$ref": "https://domain/schemas/apps/new_app" } } … ] }
  51. 51. Consumer-Driven Contracts: A Service Evolution Pattern http://martinfowler.com/articles/consumerDrivenContracts.html
  52. 52. test the services? HOWTO define services contract? manage deployment?
  53. 53. Deployment imagessearch
  54. 54. Deployment search
  55. 55. Deployment
  56. 56. test the services? HOWTO define services contract? manage deployment?
  57. 57. Contract Tests Integration
 Tests
  58. 58. be positive
  59. 59. thanks! @albertoleal albertonb@gmail.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×