Skip to content

Commit

Permalink
update entities docs
Browse files Browse the repository at this point in the history
  • Loading branch information
kelvin-muchiri committed Aug 27, 2024
1 parent 6947bf0 commit cca2b0b
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions docs/entities.rst
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,61 @@ Body:
}
]
Creating Entities
-----------------

.. raw:: html

<pre class="prettyprint"><b>POST</b> /api/v2/entity-lists/1/entities</pre>

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
-------------------
Expand Down

0 comments on commit cca2b0b

Please sign in to comment.