- First, we create a database using a database service like SQL.
- We define models with fields that will store data.
model example: Asset
model field name example: asset_name
model field type example: string/character
- We define serializers, which are data validation tools.
- We define API views for data collection.
- We define methods, which determine the type of action to perform on the database.
example methods: update, delete, view, add
- We set up authentication for the API to protect API views & data.
- We define endpoints, which will enable the communication between the server and the client.
- Each endpoint is connected to an API View, which sends or retrieves data to/from the database.
- We test each endpoint to ensure they perform the expected operations.
- After all checks have passed, we deploy to a test environment or other environment.
- The client application sends a request to the server through an API endpoint (a user attempts to view, edit, add, or delete data).
- The server confirms if the endpoint is valid/exists.
- If the endpoint is not valid, the request is rejected.
- The server sends an error response to the client.
- If the endpoint is valid, the request proceeds.
- The server confirms that the authentication credentials sent by the client are valid.
- If the credentials are invalid, the request is rejected.
- The server sends an error response to the client.
- If the credentials are valid, the request proceeds.
- The server confirms that the method used by the client in the request is valid.
- Methods perform different operations, like
update
,delete
,view
, andadd
data.
- If the method is invalid for the given endpoint, the request is rejected.
- The server sends an error response to the client.
- If the method is valid for the given endpoint, the request proceeds.
- Each method has a parameter, which tells the server how to handle the requested operation.
- The server confirms that the data sent in the endpoint is valid for the endpoint's method parameters.
- If a parameter is invalid for the method associated with the endpoint, the request is rejected.
- The server sends an error response to the client.
- If all parameters are valid for the method associated with the endpoint, the request proceeds.
- Data received from the client is collected for processing.
- The data collected is passed into a serializer, which validates it.
- If the data received is improperly formatted as per the specifications in the database, the request is rejected.
- The server sends an error response to the client.
- If the data received is correctly formatted as per the specifications in the database, the request proceeds.
- The client can now add/fetch data to/from the database, or manipulate it (edit, delete).
- If there is any problem with the request to add, fetch, or manipulate data, the request fails.
- The server sends an error response to the client.
- If there is no problem with the request, the server sends a successful response to the client.
- The response from the server to the client may include data and/or a status code.