Livestock
Index
Introduction
This documentation describes the API related to livestock and field paddock management. The API provides endpoints for operations such as herd management, livestock transactions, transaction types, and field paddock management.
Activating the livestock module in the extension's claimset is required.
API
Paddock
The paddock
entity is the spatial unit that contains livestock. This entity is necessary to indicate the division of the field.
Endpoint: /livestock/paddock
GET
Description
Retrieves all paddocks or a specific paddock.
Input Parameters
The paddock_uuid
parameter can be sent in the PATH (/livestock/paddock/<paddock_uuid>
). If not sent, all Paddock are retrieved.
Filtering by field_id
is possible to obtain Paddock from a specific field.
Response
{
"data": [
{
"paddock_id": 5,
"paddock_uuid": "1125a934-71b6-4d17-9a1a-a5d9369805a2",
"name": "Parcela 1 test",
"creation_ts": "2023-05-22",
"shape": "POLYGON((-59.6969175338745 -34.1914642334418,-59.6950721740723 -34.1924581727268,-59.6953725814819 -34.193487597494,-59.6972608566284 -34.1941620413899,-59.6992778778076 -34.1938070715907,-59.698805809021 -34.1923871774521,-59.6976470947266 -34.1918547109865,-59.6969175338745 -34.1914642334418))",
"area": 7.57465980374813
},
{
"paddock_id": 3,
"paddock_uuid": "26ce6e4c-d3f0-4c67-89e7-f4ec2b3bdc54",
"name": "Parcela 1 test (patch 2)",
"creation_ts": "2023-05-22",
"shape": "POLYGON((-59.6969175338745 -34.1914642334418,-59.6950721740723 -34.1924581727268,-59.6953725814819 -34.193487597494,-59.6972608566284 -34.1941620413899,-59.6992778778076 -34.1938070715907,-59.698805809021 -34.1923871774521,-59.6976470947266 -34.1918547109865,-59.6969175338745 -34.1914642334418))",
"area": 3.77398852224927
}
]
}
POST
Description
Creates a new paddock in the field.
Input Parameters
Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Crear Parcela",
"type": "object",
"properties": {
"field_id": {
"type": "number"
},
"shape": {
"type": "string",
"description": "WKT format"
},
"date": {
"type": "string",
"format": "date-time"
},
"name": {
"type": "string"
}
},
"required": [
"field_id",
"shape",
"date",
"name"
]
}
Example:
{
"field_id": 123456,
"shape":"POLYGON((-59.69691753387451 -34.19146423344178,-59.695072174072266 -34.19245817272681,-59.69537258148192 -34.19348759749397,-59.69726085662841 -34.19416204138989,-59.69927787780762 -34.19380707159075,-59.698805809020996 -34.19238717745208,-59.69764709472656 -34.19185471098653,-59.69691753387451 -34.19146423344178))",
"date": "2023-05-22T15:27:09.147Z",
"name":"Parcela 1 test"
}
PATCH
Description
Modifies a created paddock.
Input Parameters
The paddock_uuid
must be sent in the path (/livestock/paddock/<paddock_uuid>
).
Schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Modificar Parcela",
"type": "object",
"anyOf": [
{
"required": ["name"]
},
{
"required": ["shape"]
}
],
"properties": {
"name": {
"type": "string"
},
"shape": {
"type": "string",
"description": "WKT format"
}
}
}
Example:
{
"name":"Parcela 1 test (patch 2)",
"shape":"POLYGON((-59.69691753387451 -34.19146423344178,-59.695072174072266 -34.19245817272681,-59.69537258148192 -34.19348759749397,-59.69726085662841 -34.19416204138989,-59.69927787780762 -34.19380707159075,-59.698805809020996 -34.19238717745208,-59.69764709472656 -34.19185471098653,-59.69691753387451 -34.19146423344178))"
}
DELETE
Description
Deletes a paddock.
Input Parameters
The paddock_uuid
must be sent in the path (/livestock/paddock/<paddock_uuid>
).
Herd
The herd
entity corresponds to the unit of livestock being worked with.
Endpoint: /livestock/herd
GET
Description
Fetches information of all herds.
Response
Example:
{
"data": [
{
"herd_name": "test",
"farm_uuid": "ce33ffaf-ddb0-411b-ab1a-2f2f7c79c2e9",
"weight": 1500.0,
"type_id": 2,
"paddock_id": 1,
"farm_id": 72560,
"field_id": 258388,
"herd_uuid": "805802f5-84c1-4ed0-a3e3-1a9afad18cfd",
"field_uuid": "bf74402d-4721-49f9-8328-7313b02b4dfc",
"date_of_last_transaction": null,
"animal_count": 3,
"herd_id": 1,
"weight_unit": "Kg"
},
{
"herd_name": "otro test",
"farm_uuid": "ce33ffaf-ddb0-411b-ab1a-2f2f7c79c2e9",
"weight": 9000.0,
"type_id": 3,
"paddock_id": 2,
"farm_id": 72560,
"field_id": 258388,
"herd_uuid": "22184736-dc13-4636-8d33-4eaba40af812",
"field_uuid": "bf74402d-4721-49f9-8328-7313b02b4dfc",
"date_of_last_transaction": null,
"animal_count": 8,
"herd_id": 3,
"weight_unit": "Kg"
}
]
}
POST
Description
Creates a new herd.
Input Parameters:
Below is the schema required to create a herd. If the herd_uuid
parameter of the herd is not defined, one will be created and returned in the POST response.
The parameters paddock_uuid
and field_id
must be sent.
Refer to Herd Categories to understand the type_id
parameter.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Crear Rodeo",
"type": "object",
"properties": {
"type_id": {
"type": "number"
},
"animal_count": {
"type": "number"
},
"paddock_uuid": {
"type": [ "string", "null" ]
},
"weight": {
"type": "number"
},
"weight_unit": {
"type": "string"
},
"herd_name": {
"type": "string"
},
"field_id": {
"type": "number"
}
},
"required": [
"type_id",
"animal_count",
"weight",
"weight_unit",
"herd_name",
"field_id",
"paddock_uuid"
]
}
PATCH
Description
Modifies a herd.
Input Parameters
The herd_uuid
parameter must be sent in the path (/livestock/herd/<herd_uuid>
).
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Modificar Rodeo",
"type": "object",
"properties": {
"type_id": {
"type": "number"
},
"herd_name": {
"type": "string"
},
"new_animals": {
"type": "object",
"properties": {
"new_animals_count": {
"type": "number"
},
"new_animals_weight": {
"type": "number"
},
"new_animals_weight_unit": {
"type": "string"
}
},
"required": [
"new_animals_count",
"new_animals_weight",
"new_animals_weight_unit"
]
}
},
"required": [
"type_id",
"herd_name",
"new_animals"
]
}
DELETE
Description
Deletes a herd.
Input Parameters
The herd_uuid
parameter must be sent in the path (/livestock/herd/<herd_uuid>
).
Herd Categories
Endpoint: /livestock/herd/categories
GET
Description
Fetches all livestock categories.
Response
{
"data": [
{
"id": 1,
"name": "Terneros"
},
{
"id": 2,
"name": "Terneras"
},
{
"id": 3,
"name": "Novillito"
},
{
"id": 4,
"name": "Novillos"
},
{
"id": 5,
"name": "Vaquillonas"
},
{
"id": 6,
"name": "Vacas Invernada"
},
{
"id": 7,
"name": "Vacas Cría"
},
{
"id": 8,
"name": "Toros"
}
]
}
Exits
Exits record a movement of livestock. This movement can be of different types.
Endpoint: /livestock/transaction/exit
POST
Description
Enters an exit for livestock.
Input Parameters
If the destination_type
parameter is sent as Exit to another herd, the destination_herd_uuid
parameter must be sent as the UUID of the destination herd.
See Exit Types to understand the destination_type
parameter.
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Ingresar Salida de Ganado",
"type": "object",
"required": [
"destination_type",
"animal_count",
"weight",
"weight_unit",
"origin_herd_uuid",
"destination_herd_uuid",
"transaction_uuid",
"transaction_date"
],
"properties": {
"destination_type": {
"type": "integer"
},
"animal_count": {
"type": "integer"
},
"weight": {
"type": "integer"
},
"weight_unit": {
"type": "string"
},
"origin_herd_uuid": {
"type": "string",
"format": "uuid"
},
"destination_herd_uuid": {
"type": "string",
"format": "uuid"
},
"transaction_uuid": {
"type": "string",
"format": "uuid"
},
"transaction_date": {
"type": "string",
"format": "date-time"
}
}
}
Exit Types
Livestock can have different types of exits from a herd. For this, the types to be used to indicate an exit are defined.
Endpoint: /livestock/transaction/exit/types
GET
Description
Fetches the existing exit types.
Response Example
{
"data": [
{
"id": 3,
"type": "Faena"
},
{
"id": 2,
"type": "Salida hacia otro rodeo"
},
{
"id": 4,
"type": "Venta"
},
{
"id": 5,
"type": "Cambio de campo"
},
{
"id": 6,
"type": "Robo"
},
{
"id": 7,
"type": "Otro"
},
{
"id": 1,
"type": "Muertes"
}
]
}