%in Harare+277-882-255-28 abortion pills for sale in Harare
GraphQL or RESTful
1. GraphQL / RESTful
The dead RESTful API && Approach to Hypermedia
minayaleon@gmail.com
2. RESTful is dead?
if google says it then it is true.
or not?
minayaleon@gmail.com
3. Why?
• Requires many requests to obtain the necessary data in a view of our
application
• If the endpoint changes then the clients fall
• The error codes 2XX, 3XX, 4XX or 5XX are not used
• It does not have a formalized type system losing the power of tools
like Swagger to document
• REST is very old
minayaleon@gmail.com
4. GraphQL
• It was created by Facebook
• Is a query language for APIs and for executing queries by using a type
system you define for your data
• Use a strong typing system
• It isn't tied to any specific database or storage engine and is instead
backed by your existing code and data.
minayaleon@gmail.com
12. But…
• Change the endpoint
• Add new input parameters in the endpoints
• We launch a new version
• http://api.lifetap.com/v1, http://api.lifetap.com/v2
• More and more features
minayaleon@gmail.com
14. What should we do?...
minayaleon@gmail.com
And when can not?
15. Conclusions II
• We have forgotten the most important features of the web: Evolution
• The web has survived more than 30 years
• We must create Evolvable APIs
minayaleon@gmail.com
16. How to create APIs
designed to evolve?
minayaleon@gmail.com
19. Your project uses hypermedia
• But it is very limited
minayaleon@gmail.com
20. Hypermedia - Controls
Home
• One single URL (Home)
• The APIs are navigable
Types of controls
• How does an application
navigate?
• IANA define 80 types of links
• We can create more types
minayaleon@gmail.com
27. Shared Vocabularies
• Types and Properties
• screma.org has defined 600 types and 870 properties.
• We can create more types and properties
• The data models should not be exposed, they must be normalized.
• The clients should know the types and properties
minayaleon@gmail.com
30. Use Case: Convert MOV to MP4
API
192.168.5.67
Process
195.168.5.56
• Request
• Queries
• CRUD
• and more…
• Jobs
• Sync DB
• Video Convert
• CDN
https://proc.lifetap.com/upload-videohttps://api.lifetap.com/upload-video
SSH
1
2
minayaleon@gmail.com
33. Use nouns, no verbs.
Resource Name
• When we write code, we name the
methods with verbs that describe
their functionality. For example,
get_users or getUsers. This is fine in
the code. But it's also common in
URLs and it's not a good practice
• keep it simple
• The important is focus on the nouns
that describe each resource. Now, to
operate on our resource we will use
HTTP verbs.
Relations
• What happens when our
resources are related?
/getUsers, /getUserById, /createUser, /editUser
/users, /users/:id, /products, /orders
/orders/:id/products
/projects/:id/segments/:id/qualifications
minayaleon@gmail.com
34. Methods
HTTP Verbs CRUD Action
GET Read Use GET requests to retrieve resource representation/information
only
POST Create Use POST APIs to create new resources
PUT Update/Replace Use PUT APIs to update existing resource
PATCH Update/Modify HTTP PATCH requests are to make partial update on a resource
DELETE Delete As the name applies, DELETE APIs are used to delete resources
minayaleon@gmail.com
35. Errors Code
Code Description
200 OK
400 Bad Request
401 Unauthorized
404 Resource not found
500 Internal Server Error
minayaleon@gmail.com