diff --git a/docs/entities.rst b/docs/entities.rst index 3af529122a..3c39f6a8da 100644 --- a/docs/entities.rst +++ b/docs/entities.rst @@ -419,6 +419,61 @@ Body: } ] +Creating Entities +----------------- + +.. raw:: html + +
POST /api/v2/entity-lists/1/entities+ +This endpoint is used for creating a single Entity in the Entity List. + +The data is passed as JSON in the request body. The following keys are available: + +- ``label`` - A user-friendly label for forms that use Entities. +- ``data`` - An object with values for user-defined Dataset properties. (Not all properties need to have values.). A property must exist in the EntityList dataset. +- ``uuid`` (optional) - A unique ID. If not provided, one will be generated for the Entity upon creation. + +All property values are of type string. + +**Example** + +.. code-block:: bash + + + curl -X POST https://api.ona.io/api/v2/entity-lists/1/entities \ + -H "Authorization: Token ACCESS_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{ + "label": "30cm mora", + "uuid": "dbee4c32-a922-451c-9df7-42f40bf78f48", + "data": { + "geometry": "-1.286805 36.772845 0 0", + "species": "mora", + "circumference_cm": 30 + } + }' + +**Response** + +Status: ``201 Created`` + +Body: + +.. code-block:: json + + { + "id": 1, + "uuid": "dbee4c32-a922-451c-9df7-42f40bf78f48", + "date_created": "2024-06-20T07:37:20.416054Z", + "date_modified": "2024-06-20T08:37:20.416054Z", + "data": { + "geometry": "-1.286805 36.772845 0 0", + "species": "mora", + "circumference_cm": 30, + "label": "30cm mora", + } + } Get Entity Details -------------------