*******************************************************************************
Application API
*******************************************************************************
The EMERGEN-DB API is built from the Django REST framework whose official
website is `available here `_.
How to add an API?
===============================================================================
#. Step 1 - Create a serializer in the serializers.py
#. Step 2 - Create a view in :code:`view.py`
#. Step 3 - Create a url to access the API in the :code:`ulrs.py` ;
#. Step 4 - Test the API in the :code:`test.py` file. Many examples are already available in the file.
A complete example is available on the `official documentation `_
and APIs are already available in the application. They can help you in the structure
to follow.
Key files of the "API" application
===============================================================================
serializers.py
-------------------------------------------------------------------------------
The EMERGEN-DB API is built from the Django REST framework. To format the results
returned by the API, serializers are created whose official documentation is
`here `_ :
.. automodule:: apps.api.serializers
:members:
tasks.py
-------------------------------------------------------------------------------
.. automodule:: apps.api.tasks
:members:
ulrs.py
-------------------------------------------------------------------------------
The :code:`urls.py` file contains :
- The addresses of the various GET APIs that begin with :code:`api/` ;
- A special address for the API POST (sending Excel files via the API) ;
- An address for the `OPEN API `_ page ;
- An address to display the APIs by `SWAGGER `_
.. tests.py
.. -------------------------------------------------------------------------------
.. .. automodule:: apps.api.tests
.. :members:
.. views.py
.. -------------------------------------------------------------------------------
.. .. automodule:: apps.api.views
.. :members: