From 8ec27191b68e82d14ad9dccd586df96e43b30dd1 Mon Sep 17 00:00:00 2001 From: moanos Date: Mon, 25 Nov 2024 16:27:42 +0100 Subject: [PATCH] docs: Document API methods --- docs/API/index.rst | 53 +++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 5 deletions(-) diff --git a/docs/API/index.rst b/docs/API/index.rst index f1ed29e..9970376 100644 --- a/docs/API/index.rst +++ b/docs/API/index.rst @@ -2,10 +2,10 @@ 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:: - 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 ========== @@ -27,6 +27,13 @@ An application can then send this token in the request header for authorization. .. code-block:: $ 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 --------- @@ -35,7 +42,7 @@ Get Adoption Notices .. code-block:: curl --request GET \ - --url http://localhost:8000/api/adoption_notice \ + --url https://notfellchen.org/api/adoption_notice \ --header 'Authorization: {{token}}' Create Adoption Notice @@ -43,7 +50,7 @@ Create Adoption Notice .. code-block:: curl --request POST \ - --url http://localhost:8000/api/adoption_notice \ + --url https://notfellchen.org/api/adoption_notice \ --header 'Authorization: {{token}}' \ --header 'content-type: multipart/form-data' \ --form name=TestAdoption1 \ @@ -51,4 +58,40 @@ Create Adoption Notice --form 'description=Lorem ipsum **dolor sit** amet' \ --form further_information=https://notfellchen.org \ --form location_string=Berlin \ - --form group_only=true \ No newline at end of file + --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}}'