From Event to Action: Accelerate Your Decision Making with Real-Time Automation
APIDays 2018 - API Development Lifecycle - The secret ingredient behind RESTful APIs Specifications
1. THE SECRET INGREDIENT
BEHIND RESTful APIs
SPECIFICATIONS
How to better document, make relevant examples and better
test APIs ?
Paris, 30th of january 2018
2. 2//
Who has already met
a crash on frontend
due to a response not
matching the
API specification?
5. 5//
Design UX/UI
IS legacy opening and
integraton Architecture
Devops Front end web
Big Data, Smart
Data, Fast Data
Back end web
AI
(chat bots, machine learning…)
SaaS - PaaS / Cloud IOT
Mobile Apps
(development, product
management) API management
Front end web
7. 7//
Customers, Project Managers, Developers
Project Manager tries to find where the problem comes from...
There is a crash
on my app!!!
We’re looking for the
source of the problem
8. 8//
Customers, Project Managers, Developers
Regarding logs, Project Manager has identified it’s related to a specific API call
There is a crash
on my app!!!
We’re looking for the
source of the problem
Where does it come from?
Let’s have a look at the logs
Oh it seems to be related to
this specific API call
9. 9//
Customers, Project Managers, Developers
Project Manager asks the developer why we have met this problem and how to fix it...
Could you fix it quickly
please? It’s critical...
Could you tell me why the app crash
when it does such API call please?
10. 10//
Customers, Project Managers, Developers
Developer gives the diagnosis...
Could you tell me why the app crash
when it does such API call please?
Oh I see
why it’s
crashing...
Could you fix it quickly
please? It’s critical...
11. 11//
Customers, Project Managers, Developers
Developer gives the diagnosis...API specification does not match the current response that causes the frontend crash!
Could you tell me why the app crash
when it does such API call please?
Oh I see
why it’s
crashing...
..it’s because API specification I used for my dev
does not match this response...
Could you fix it quickly
please? It’s critical...
12. 12//
Customers, Project Managers, Developers
We wonder where is the truth… we all faced the same problems
WHICH SPECIFICATIONS
ARE WE TALKING ABOUT?
WHICH SPECIFICATIONS
ARE WE TALKING ABOUT?
WHICH SPECIFICATIONS
ARE WE TALKING ABOUT?
17. 17//
Three options
One tool to rule them all
(POSTMan, Restlet have more &
more features)
Synchronize different tools,
highly dependent on what
they allow to import or export
Build a new tool
01
02
03
23. 23//
Attributes of a resource
Example - A user
id
firstname
lastname
age
User
{
"user": {
"id": 1200,
"firstname": "Arthur",
"lastname": "Martin",
"age": 17
}
}
JSON Instance
24. 24//
Get user information
GET /users/:id
Routes
Example - user resource
Create a user
POST /users
Update a user
PUT /users/:id
Delete a user
DELETE /users/:id
27. 27//
Representation of your resource
Example - create a user
POST /users - Body of request
{
"title": "User",
"type": "object",
"properties": {
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"required": ["firstName", "lastName"]
}
}
firstname
lastname
User
28. 28//
Representation of your resource
Example - get user information
GET /users/:id - Body of response
{
"title": "User",
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"firstname": {
"type": "string"
},
"lastname": {
"type": "string"
},
"age": {
"description": "Age in years",
"type": "integer",
"minimum": 0
},
"required": [“id”,"firstName", "lastName"]
}
}
id
firstname
lastname
age
User
29. 29//
Pericles: API Description
A whole API project through representations
YOUR PROJECT
RESOURCES
ATTRIBUTES ROUTES
REQUESTS RESPONSES
Resource representations
30. 30//
Pericles: API Description
A whole API project through representations
YOUR PROJECT
RESOURCES
ATTRIBUTES ROUTES
REQUESTS RESPONSES
JSON SCHEMA Collection
Resource representations
35. 35//
Customer, Project Managers
Lost of time in trying to replay a use case...
My app is crashing again,
it’s embarrassing...
I’ll take a look at it
OK I’m good for an hour to replay this use case,
but pretty sure my customer API is faulty
37. 37//
Project Managers, Developers
Lost of time in updating thousands of files...
So could you please update the specs
with the new API specifications please?
Sure...
I need to modify thousands of files
(mocks, doc, …), what a nightmare!
40. 40//
Customers, Project Managers, Developers
Problems solved - time saving for everyone !
My specs are always
up to date!
When the API is not
aligned with the specs
I will know it easily!
Keeping the specs up to
date is now simple!