SlideShare une entreprise Scribd logo
1  sur  22
Télécharger pour lire hors ligne
Building APIs you will
love
Stuff that I learn from reading `Building
APIs you won't hate` book and a little of
my input
Prepare by Fathur Rahman
Plural, Singular or Both naming?
GET /user or GET /users?
GET /user/1 or GET /users/1?
- Always use Plural for consistency.
- Dev don't need to guess whether GET /users will return a list of User,
- If GET /user will left the dev guessing will it return a single user or a list of
user
- Combining GET /users for list of user and GET /user/1 for single user is not
consistent
RESTful endpoints convention
- GET /places/
- GET /places/X
- GET /places/X,Y,Z
- GET /places/X/checkins
- GET /users/X/checkins
- GET /users/X/checkins/Y
Resources and subresources
Auto increment is devil
- Use UUID instead of ID for identification
- Imagine launching a massively anticipated
product, and the user can see the current
company_id is 2 only
Data relationship
1. Category 1 or author 1 doesn’t doesn’t contain enough info for
the API client
2. If client want to display category name, need extra API call.
Imagine 500 API call just to get category info for a Blog post
list page
Data relationship (cont)
Two strategies:
1. Relationship expanded by default
2. Relationship on-demand expand
Data relationship
1. Expanded by default
GET /users/1
Data relationship (cont)
2. On-demand expand
GET /users/1?expand=category
Response envelope
1. Always use data envelope so we can add extra metadata when needed
2. Example the response below, if we want to add list of expands available, it will
be weird if we add another key that doesn’t belongs to Blog post object
Response envelope (cont)
1. When using envelope, we can add any extra metadata that we need, without
actually modify the main response Object
2. If we are adding envelope when only we needed extra metadata, then the API
response structure is not consistent
Next, a little of my inputs as Front End
developer
Don't forget to check out the book!
https://apisyouwonthate.com/
POST vs PUT vs PATCH?
1. Use POST when creating a new record
2. Use PUT when you want to update a full object. Example update a Blog post
using form
3. Use PATCH when you want to update a part of the Object. Example update
only the title of blog post
POST vs PUT vs PATCH?
PUT
PATCH
Data consistency through all channels
- Sometimes, API dev transform the data for client consumption via Serializer /
Transformer
- Example below, url value is transform to include the host URL (http://test.com/)
- However, we forget to make it the data transform consistent through all channels, as
during development there is multiple way to access the data
API / Console / Unit Test
Console / Unit Test
Don't assume, but give options
- Example if we have API to return list of
categories
- There is category without parent, and
category with parent (subcategory)
Don't assume, but give options
- Provide filter key for the FE to
filter the data. Example
/categories?parent_only
- API should not assume that FE
only want parent category, and
doesn’t include the subcategory
in the response
Need to format the data? Time for
more endpoints
- For example, we want to get the
Categories response in Nested Tree
format
- It will be tempting to add key
/categories?format=tree
Need to format the data? Time for
more endpoints
- Don’t do this, as the response data structure is now
inconsistent. Original is array of Categories, now it return
Tree object
- We can have dedicated endpoints for this
Eg:
GET /treecategories
Sometimes, it’s good to assume
- For example, API can order list of data by default DESC,
since FE always interested with the latest data first
- Another example, to get list of post published this week, API
can provide filter key ?currweek_publish rather than FE
sending ?start_date and ?end_date
- This will save FE from writing the same logic at different
client (mobile / web / desktop)
Input param must be consistent
- Existing API using this input convention
- When API dev install new package, the package is expecting
input key in this format
Input param must be consistent
- It doesn’t make sense for the FE to use the new key
convention. FE doesnt need to know the Backend
implementation details
- BE need to map the key to follow existing convention which is
model_type and model_id. So all the API endpoints using
consistent input keys

Contenu connexe

Plus de Xoxzo Inc.

Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5Xoxzo Inc.
 
The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1Xoxzo Inc.
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawaXoxzo Inc.
 
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門Xoxzo Inc.
 
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...Xoxzo Inc.
 
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal AbdullahJomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal AbdullahXoxzo Inc.
 
Introduction to Data Analysis
Introduction to Data AnalysisIntroduction to Data Analysis
Introduction to Data AnalysisXoxzo Inc.
 
XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017Xoxzo Inc.
 
初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門Xoxzo Inc.
 
djangoのmigrationはどう動いているか
djangoのmigrationはどう動いているかdjangoのmigrationはどう動いているか
djangoのmigrationはどう動いているかXoxzo Inc.
 
PyCon APAC 2017
PyCon APAC 2017PyCon APAC 2017
PyCon APAC 2017Xoxzo Inc.
 
Pythonの隠れた武器
Pythonの隠れた武器Pythonの隠れた武器
Pythonの隠れた武器Xoxzo Inc.
 
The Secret Weapon Of Python
The Secret Weapon Of PythonThe Secret Weapon Of Python
The Secret Weapon Of PythonXoxzo Inc.
 

Plus de Xoxzo Inc. (13)

Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5Linear algebra power of abstraction - LearnDay@Xoxzo #5
Linear algebra power of abstraction - LearnDay@Xoxzo #5
 
The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1The Takumi Method - LearnDay@Xoxzo #1
The Takumi Method - LearnDay@Xoxzo #1
 
Django osc2018-okinawa
Django osc2018-okinawaDjango osc2018-okinawa
Django osc2018-okinawa
 
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
多要素認証やSMSマーケティングを支えるテレフォニーAPI活用入門
 
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
Working in a Fully Remote Organization: Challenges and How We Made it Work - ...
 
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal AbdullahJomLaunch 5.0 Sep 2017 by Iqbal Abdullah
JomLaunch 5.0 Sep 2017 by Iqbal Abdullah
 
Introduction to Data Analysis
Introduction to Data AnalysisIntroduction to Data Analysis
Introduction to Data Analysis
 
XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017XoxzoテレフォニーAPI入門2017
XoxzoテレフォニーAPI入門2017
 
初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門初心者のためのPythonによるWebAPI活用方入門
初心者のためのPythonによるWebAPI活用方入門
 
djangoのmigrationはどう動いているか
djangoのmigrationはどう動いているかdjangoのmigrationはどう動いているか
djangoのmigrationはどう動いているか
 
PyCon APAC 2017
PyCon APAC 2017PyCon APAC 2017
PyCon APAC 2017
 
Pythonの隠れた武器
Pythonの隠れた武器Pythonの隠れた武器
Pythonの隠れた武器
 
The Secret Weapon Of Python
The Secret Weapon Of PythonThe Secret Weapon Of Python
The Secret Weapon Of Python
 

Dernier

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 

Dernier (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 

Build APIs You Won't Hate - LearnDay@Xoxzo #20

  • 1. Building APIs you will love Stuff that I learn from reading `Building APIs you won't hate` book and a little of my input Prepare by Fathur Rahman
  • 2. Plural, Singular or Both naming? GET /user or GET /users? GET /user/1 or GET /users/1? - Always use Plural for consistency. - Dev don't need to guess whether GET /users will return a list of User, - If GET /user will left the dev guessing will it return a single user or a list of user - Combining GET /users for list of user and GET /user/1 for single user is not consistent
  • 3. RESTful endpoints convention - GET /places/ - GET /places/X - GET /places/X,Y,Z - GET /places/X/checkins - GET /users/X/checkins - GET /users/X/checkins/Y Resources and subresources
  • 4. Auto increment is devil - Use UUID instead of ID for identification - Imagine launching a massively anticipated product, and the user can see the current company_id is 2 only
  • 5. Data relationship 1. Category 1 or author 1 doesn’t doesn’t contain enough info for the API client 2. If client want to display category name, need extra API call. Imagine 500 API call just to get category info for a Blog post list page
  • 6. Data relationship (cont) Two strategies: 1. Relationship expanded by default 2. Relationship on-demand expand
  • 7. Data relationship 1. Expanded by default GET /users/1
  • 8. Data relationship (cont) 2. On-demand expand GET /users/1?expand=category
  • 9. Response envelope 1. Always use data envelope so we can add extra metadata when needed 2. Example the response below, if we want to add list of expands available, it will be weird if we add another key that doesn’t belongs to Blog post object
  • 10. Response envelope (cont) 1. When using envelope, we can add any extra metadata that we need, without actually modify the main response Object 2. If we are adding envelope when only we needed extra metadata, then the API response structure is not consistent
  • 11. Next, a little of my inputs as Front End developer Don't forget to check out the book! https://apisyouwonthate.com/
  • 12. POST vs PUT vs PATCH? 1. Use POST when creating a new record 2. Use PUT when you want to update a full object. Example update a Blog post using form 3. Use PATCH when you want to update a part of the Object. Example update only the title of blog post
  • 13. POST vs PUT vs PATCH? PUT PATCH
  • 14. Data consistency through all channels - Sometimes, API dev transform the data for client consumption via Serializer / Transformer - Example below, url value is transform to include the host URL (http://test.com/) - However, we forget to make it the data transform consistent through all channels, as during development there is multiple way to access the data
  • 15. API / Console / Unit Test Console / Unit Test
  • 16. Don't assume, but give options - Example if we have API to return list of categories - There is category without parent, and category with parent (subcategory)
  • 17. Don't assume, but give options - Provide filter key for the FE to filter the data. Example /categories?parent_only - API should not assume that FE only want parent category, and doesn’t include the subcategory in the response
  • 18. Need to format the data? Time for more endpoints - For example, we want to get the Categories response in Nested Tree format - It will be tempting to add key /categories?format=tree
  • 19. Need to format the data? Time for more endpoints - Don’t do this, as the response data structure is now inconsistent. Original is array of Categories, now it return Tree object - We can have dedicated endpoints for this Eg: GET /treecategories
  • 20. Sometimes, it’s good to assume - For example, API can order list of data by default DESC, since FE always interested with the latest data first - Another example, to get list of post published this week, API can provide filter key ?currweek_publish rather than FE sending ?start_date and ?end_date - This will save FE from writing the same logic at different client (mobile / web / desktop)
  • 21. Input param must be consistent - Existing API using this input convention - When API dev install new package, the package is expecting input key in this format
  • 22. Input param must be consistent - It doesn’t make sense for the FE to use the new key convention. FE doesnt need to know the Backend implementation details - BE need to map the key to follow existing convention which is model_type and model_id. So all the API endpoints using consistent input keys