API Checklist
Do's and Don'ts
Always define the Yaml for your APIs as the first thing using Open API 3 Standard (https://swagger.io/specification/).
APIs path should be standardised as follows:
/{service}/{entity}/{version}/_create: This endpoint should be used to create the entity.
/{service}/{entity}/{version}/_update: This endpoint should be used to edit an entity which is already existing.
/{service}/{entity}/{version}/_search: This endpoint should be used to provide a search on the entity based on certain criteria.
/{service}/{entity}/{version}/_count: This endpoint should be provided to give a count of entities that match the given search criteria.
Always use POST for each of the endpoints.
Take most search parameters in the POST body only.
If query params for search need to be supported then make sure to have the same parameters in the POST body also and the POST body should take priority over query params.
Provide additional detail for objects in _create and _update APIs so that custom requirements can use these fields.
Each API should have a RequestInfo object in the request body at the top level.
Each API should have a ResponseInfo object in the response body at the top level.
Mandatory fields should be the minimum for the APIs.
minLength and maxLength should be defined for each attribute.
Read-only fields should be called out.
Use common models already available in the platform in your APIs. Example -
For receiving files in an API, do not use binary file data. Instead, accept the file store ids.
If there is only one file to be uploaded and no persistence is needed, and no additional JSON data is to be posted, you can consider using direct file upload instead of using filestore id.
APIs developed on DIGIT follow certain conventions and principles. The aim of this document is to provide some do’s and don’ts while following these principles.
Last updated