In this blog we will learn what is API Schema
The first time i heard about schema was in the context of the databases.In database, schema defines the relationships between tables, columns and information found within a database.The schema defines a database, say outline to help programmers properly understand the relationships between tables, views, procedures which enables them to retrieve data they want properly.
Now think of an API. An API is an interface that allows two chunks
of software, services, or platforms to interact with each
other.
If you want to learn what are API's, then refer my log
API's... what are these afterall
How convenient would it be for developers if they had the equivalent of a database schema for an API?
API specifications represent a contract for an API.You might have
heard of contract to get a job, or rent/buy a house etc. Same way
API schema is a contract for an API.Schemas help define and
describe APIs.
The need to define and describe APIs led to various API
Description Languages (API DL) such as RAML, Swagger etc. With an
API specification and tools such as Swagger UI, you can visualize
your API. Visualizing your API helps a lot as it would enable
other developers,testers and even stakeholders to learn and give
design feedback early on. You can even run a mock service based on
an API spec that other teams can immediately interact with.
If you want to learn about setting up mock server then refer my
blog
Postman mock server
Identifying issues in the design before writing any code is
a much more efficient and streamlined approach than doing so after
an implementation is already in place.Just imagine the time and
resources wasted if you have to rewrite the code because design
has changed. Once code is rewritten the whole life cycle of
code,test,bug fix starts again
In any project, it's quite normal to have multiple teams(backend, web, mobile, etc.).Having an API Schema helps development to happen much faster than the team who follows traditional methods . Frontend teams can immediately start building components regardless of whether the backend components are ready, because we can generate and run mock services based on an API specification. Testers can start writing test cases. Basically, it allows the teams to work in parallel, without being blocked by another team's progress.
API specs can be used to automatically scaffold an API, generate an API reference, and client SDKs that communicate with the API.
To conclude, what I would say is that,it may take some time and meetings (across teams) to decide on the API schema,but having an API schema before developers start developing adds lots of benefits which we saw above.Therefore, benefits outweigh the initial cost.
And that's it.Email me at "techspacedeck@gmail.com" incase you have queries. Alternatively, you can fill the "CONTACT" form or drop a comment below