minecraft_manager/docs/source/api.rst

45 lines
1.1 KiB
ReStructuredText
Raw Normal View History

2018-10-13 01:58:33 +00:00
.. include:: common.rst
.. _api:
API Usage
=========
Model API
---------
.. warning::
You will need to pass the API password with any request in order for the API to respond. |br|
The API will only respond to an authenticated user or a request containing the correct API password. |br|
Send the password with the key ``api``
The model API is used to query any of the :ref:`models` and get back results in a JSON format.
.. note::
This assumes that your base API URL is http://localhost:8000/api/\. |br|
Your URL may be something like \http://www.yoursite.com/mcm/api/.
You can include any Django filters_ as GET parameters to filter your search.
.. _filters: https://docs.djangoproject.com/en/2.0/ref/models/querysets/#id4
Sample Queries
~~~~~~~~~~~~~~
Querying applications with the word ``test`` in the username.
::
http://localhost:8000/api/model/application/?username__icontains=test
Querying applications whose age is over ``20``.
::
http://localhost:8000/api/model/application/?age__gt=20
Querying tickets sent in by ``Etzelia``.
::
http://localhost:8000/api/model/ticket/?player__username=Etzelia