docs: Document API methods
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
parent
c1332ee1f0
commit
8ec27191b6
@ -2,10 +2,10 @@
|
|||||||
API Documentation
|
API Documentation
|
||||||
*****************
|
*****************
|
||||||
|
|
||||||
The Notfellchen API serves the purpose of supporting 3rd-person applications and anything you can think of basically.
|
The Notfellchen API serves the purpose of supporting 3rd-person applications, whether you want to display data in a custom format or add data from other sources.
|
||||||
|
|
||||||
.. warning::
|
.. warning::
|
||||||
The current API is limited in it's functionality. I you miss a specific feature please contact the developer!
|
The current API is limited in it's functionality. I you miss a specific feature please contact the developers!
|
||||||
|
|
||||||
API Access
|
API Access
|
||||||
==========
|
==========
|
||||||
@ -27,6 +27,13 @@ An application can then send this token in the request header for authorization.
|
|||||||
.. code-block::
|
.. code-block::
|
||||||
$ curl -X GET http://notfellchen.org/api/adoption_notice -H 'Authorization: Token 49b39856955dc6e5cc04365498d4ad30ea3aed78'
|
$ curl -X GET http://notfellchen.org/api/adoption_notice -H 'Authorization: Token 49b39856955dc6e5cc04365498d4ad30ea3aed78'
|
||||||
|
|
||||||
|
|
||||||
|
.. warning::
|
||||||
|
Usage or creation of content still has to follow the terms of Notfellchen.org
|
||||||
|
Copyright of content is often held by rescue organizations, so you are not allowed to simply mirror content.
|
||||||
|
Talk to the Notfellchen-Team if you want develop such things.
|
||||||
|
|
||||||
|
|
||||||
Endpoints
|
Endpoints
|
||||||
---------
|
---------
|
||||||
|
|
||||||
@ -35,7 +42,7 @@ Get Adoption Notices
|
|||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
curl --request GET \
|
curl --request GET \
|
||||||
--url http://localhost:8000/api/adoption_notice \
|
--url https://notfellchen.org/api/adoption_notice \
|
||||||
--header 'Authorization: {{token}}'
|
--header 'Authorization: {{token}}'
|
||||||
|
|
||||||
Create Adoption Notice
|
Create Adoption Notice
|
||||||
@ -43,7 +50,7 @@ Create Adoption Notice
|
|||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
curl --request POST \
|
curl --request POST \
|
||||||
--url http://localhost:8000/api/adoption_notice \
|
--url https://notfellchen.org/api/adoption_notice \
|
||||||
--header 'Authorization: {{token}}' \
|
--header 'Authorization: {{token}}' \
|
||||||
--header 'content-type: multipart/form-data' \
|
--header 'content-type: multipart/form-data' \
|
||||||
--form name=TestAdoption1 \
|
--form name=TestAdoption1 \
|
||||||
@ -51,4 +58,40 @@ Create Adoption Notice
|
|||||||
--form 'description=Lorem ipsum **dolor sit** amet' \
|
--form 'description=Lorem ipsum **dolor sit** amet' \
|
||||||
--form further_information=https://notfellchen.org \
|
--form further_information=https://notfellchen.org \
|
||||||
--form location_string=Berlin \
|
--form location_string=Berlin \
|
||||||
--form group_only=true
|
--form group_only=true
|
||||||
|
|
||||||
|
Add Animal to Adoption Notice
|
||||||
|
+++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
curl --request POST \
|
||||||
|
--url https://notfellchen.org/api/animals/ \
|
||||||
|
--header 'Authorization: {{token}}' \
|
||||||
|
--header 'content-type: multipart/form-data' \
|
||||||
|
--form name=TestAnimal1 \
|
||||||
|
--form date_of_birth=2024-11-19 \
|
||||||
|
--form 'description=Lorem animal **dolor sit**.' \
|
||||||
|
--form sex=F \
|
||||||
|
--form species=1 \
|
||||||
|
--form adoption_notice=1
|
||||||
|
|
||||||
|
Add picture to Animal or Adoption Notice
|
||||||
|
++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
curl -X POST https://notfellchen.org/api/images/ \
|
||||||
|
-H "Authorization: Token {{token}}" \
|
||||||
|
-F "image=@256-256-crop.jpg" \
|
||||||
|
-F "alt_text=Puppy enjoying the sunshine" \
|
||||||
|
-F "attach_to_type=animal" \
|
||||||
|
-F "attach_to=48
|
||||||
|
|
||||||
|
Species
|
||||||
|
+++++++
|
||||||
|
|
||||||
|
Getting available species is mainly important when creating animals
|
||||||
|
|
||||||
|
.. code-block::
|
||||||
|
curl --request GET \
|
||||||
|
--url https://notfellchen.org/api/species \
|
||||||
|
--header 'Authorization: {{token}}'
|
||||||
|
Loading…
Reference in New Issue
Block a user