How to design an API
Hello everyone, as a Back-end engineer, my main task is to develop APIs. This is a daily task, and I am increasingly looking to produce higher-quality products. Hence, we decided to collaborate with the Brands team in Cornershop by Uber to have a guide on designing an API that has factual information and is easy to consult.
So I started my research and found an excellent article that helped me with this purpose.
In this post, I summarize the article cited below and share a condensed version of the information needed to create an initial design document of an API. I’ve outlined it below with key callouts and relevant questions in each section.
An effective API design should be based on its overall corporate strategy and contribute to its objectives. You know you have good strategy elements when you can answer the following three questions clearly:
- Why do we want to implement APIs?
- What are the results we are looking to achieve with these APIs?
- How will the API be executed to achieve the desired results?
⁉️ The reason
- What is the value of the API?
- Do you have a business objective in mind? If so, what is it? Are you looking to increase earnings, explore new business models, improve time-to-market or develop new distribution channels?
- Do you have a tech objective in mind? If so, what is it? Do you want to improve mobile and app integration or allow for greater device connectivity?
🎯 The target
- What are the results we want to achieve with these APIs?
- What do APIs actually do and how do they influence the overall business strategy?
⚙️ The method
- What technology is used to design the APIs?
- How are APIs designed?
- How are APIs maintained?
- How are they promoted within the company or marketed to the outside world?
- What are the available resources?
- Who should be part of the team?
- How do we measure success against the business objectives that were set?
🧑🏼💻 The initial team
The following is a list of profiles or people that you should consider to create your work team.
- A product-focused person who is responsible for strategy and objectives
- Design-focused team members to ensure the use of API design best practices
- Engineers to implement API technology
- Members of the operations team executing it
Cornershop’s time: For example, in my team & the brands team, we have Valoche who defines the product, Seba who ensures good practices in the group and I developing the APIs
🔍 How to find and describe the API value?
- Describe the work requested by the users
- Identify specific challenges faced by users before, during, and after
- Summarize the potential benefits to the user
- Write several statements that explain, in detail, the communication between the API and the user profile.
How to define the value of your API program?
- Who is the user?
- Are they current customers, partners, external developers?
- What are their roles — are they data scientists or mobile technology developers?
- What are the requirements or preferences?
- What are the users’ weaknesses that we help mitigate or the benefits we can offer them?
- What are the case studies supported by your API?
- How can user value be increased over time? What are the essential milestones concerning internal or external changes?
- What value is generated for your company internally?
🎨 User-driven design and implementation
- Simplicity: Data format, method structure, data model, authentication, usage policies.
- Flexibility: What is the potential operating space based on?
Questions to keep in mind
To carefully analyze your API design, consider the following five questions:
- Did we design the API to support our case studies?
- Are we implementing RESTful APIs just because?
- Did we set out our data model without considering the case studies?
- Which geographical regions are the most important and have we planned our data centers accordingly?
- Did we synchronize the API design with the rest of our products?
During his keynote address at the 2012 O’Reilly Open Source Convention, John Musser highlighted the 5 keys for a suitable API:
- Provide a valuable service
- Have a plan and a business model
- Allow it to be simple, flexible and easy to adopt
- Enable its management and measurement
- Provide support to developers
- What does API design consist of? https://www.redhat.com/es/topics/api/what-is-api-design
- What Makes a Great Open API? https://www.slideshare.net/jmusser/what-makes-a-great-open-api