API Labours
Inputs
Introduction
Under the concept of input the platform allows to register any element that is applied/consumed/used in a labour, being its main use fertilizers, phytosanitary products, among others, but it is also possible to upload any other element desired by the user (organic fertilizers, seeds, etc).
There is a master list of inputs defined by Auravant, shared by all users. It is composed of a growing group of very popular products, which in turn have their components (nutrients, active ingredients, etc.), etc.). Each user can add their own inputs, which are exclusively for personal use.
Inputs in labours PATCH and POST
labours APIs PATCH and POST receive the associated inputs as a parameter. Whenever these APIs are queried it must be taken into account that inputs are not created, modified or removed from a labour individually, but always provide (when applicable) the complete and final list of them. In other words, the list should reflect their current status.
The complete list of inputs shall be provided to the corresponding API of labour, reflecting the current (and final) status of the inputs. current (and final) status.
When querying these APIs, the inputs are represented by an array with objects whose parameters are:
id
:integer
, ID of an existing input (own or master)uuid
:string
, UUID of an input, existing or newname
:string
, name of the input, which may be repeated within the user's own list.dose
:float
, dose applied.unit
:string
, unit of the dose. Examplekg/ha
.observations
:string
, any additional comment (optional).
This array allows to add or modify inputs:
- High: when no pre-existing ID or UUID is provided, such input shall be created. When a UUID is provided that does not exist in the user's personal list, it shall be created with that unique identifier (note that the name may not be unique).
- Modification: If the ID or UUID is provided and the rest of the parameters differ.
APIs
GET
List of all inputs, both general and user-specific (discriminated by the boolean flag user_input). boolean flag user_input).
Content-Type: text/plain
GET /api/registro_campo/insumos
Following parameters could be sent into the query string, and apply an AND condition to filter the list:
user_input
:boolean
, iftrue
get only the inputs created by the usercode
:integer
, input codecountry
:string
, country identifier, as followAR
,US
,BR
If the
country
filter is applied, the API returns those inputs with the selected country and those with country value equal null
Response example:
[
{
"user_input": false,
"code": "25722",
"name": "kaiso sorbie",
"density": null,
"country": "ES",
"company": "nufarm españa, s.a.",
"id": 45109,
"state": "eg",
"components": [
{
"uuid": "d971fa18-acc3-11eb-8340-e7e492ced828",
"active_principle": true,
"eiq_1": null,
"concentration": 0.05,
"id": 131,
"name": "lambda cihalotrin"
}
],
"type": "pesticida",
"composition": null,
"uuid": "f165e203-acc5-11eb-8340-bfbcc0f16154"
},
{
"user_input": false,
"code": "34120",
"name": "kalibre 25",
"density": null,
"country": "AR",
"company": "grupo agros s.a.",
"id": 50452,
"state": "ec",
"components": [
{
"uuid": "e8898fcc-acc6-11eb-8340-9358ca0ed91b",
"active_principle": true,
"eiq_1": null,
"concentration": 0.25,
"id": 430,
"name": "cipermetrina"
}
],
"type": "pesticida",
"composition": null,
"uuid": "6c029912-d825-11eb-8340-138fd03ff513"
}
]
POST
Creation of a user's personal inputs.
Content-Type: application/json
POST /registro_campo/insumo
In the body of the query, include an array of objects representing each input to be created. Each object must include:
uuid
:string
, UUID of the input.name
:string
, name of the input.
name is mandatory in each. uuid will be autogenerated if not present.
Response Example:
{
"status": "successful inputs creation",
"res": "OK",
"denied": [],
"created": [
{
"nombre": "input_test_10",
"id": 1027,
"uuid": "9b6ab856-79da-11ea-bd20-b7046fc84ed8"
},
{
"nombre": "input_test_11",
"id": 1028,
"uuid": "9b6ab857-79da-11ea-bd20-03791c820c43"
},
{
"nombre": "input_test_12",
"id": 1029,
"uuid": "9b6ab858-79da-11ea-bd20-effc08625f5f"
}
]
}
PATCH
Modification of inputs (only those registered by the user).
Content-Type: application/json
PATCH /registro_campo/insumo
In the body of the query, include an array of objects representing each input to be modified. Each object must include:
uuid
:string
, UUID of input to be modified.id
:integer
, ID of input to be modifiedname
:string
, new name of the input.
Response example:
{
"status": "successful inputs modification",
"res": "OK",
"modificated": [
{
"id": 1027,
"name": "modified_input_test_10",
"uuid": "9b6ab856-79da-11ea-bd20-b7046fc84ed8"
},
{
"id": 1028,
"name": "modified_input_test_11",
"uuid": "9b6ab857-79da-11ea-bd20-03791c820c43"
},
{
"id": 1029,
"name": "modified_input_test_12",
"uuid": "9b6ab858-79da-11ea-bd20-effc08625f5f"
}
],
"denied": []
}
DELETE
Deletion of inputs (only those registered by the user).
Content-Type: application/json
DELETE /registro_campo/insumo
In the body of the query, include an array of objects representing each input to be deleted. Each object must include:
uuid
:string
, UUID of the input.id
:integer
, ID of input.
Response example:
{
"status": "successful inputs deletion",
"res": "OK",
"deleted": [
{
"id": 1027,
"name": "modified_input_test_10",
"uuid": "9b6ab856-79da-11ea-bd20-b7046fc84ed8"
},
{
"id": 1028,
"name": "modified_input_test_11",
"uuid": "9b6ab857-79da-11ea-bd20-03791c820c43"
},
{
"id": 1029,
"name": "modified_input_test_12",
"uuid": "9b6ab858-79da-11ea-bd20-effc08625f5f"
}
],
"denied": []
}
Crops
We have a Crops API, which returns a list of available crops.
This list comes from two sources:
- Crops defined by Auravant.
- Crops manually registered by users.
GET /getcultivos
Labours
In Auravant, any activity carried out in a field is called labour and can be registered through the "Season Register" module.
Currently there are three types of labours:
Much of the potential of the feature lies in the fact that all types of labour have information in common. However, each has specific data to be collected, specific to the activity.
Association to a Season In order to reflect as faithfully as possible the form of fieldwork, every labor is associated to a season, the latter acting as a grouping that allows not only to identify those activities carried out in the same production cycle but also to order them in time. For this purpose, the yeargroup parameter is used, which defines the year or years in which the season takes place. In this way a yeargroup = 2019 can identify a production cycle that takes place entirely in the year 2019 or one that started in 2019 and ended in the following year (this discrimination being made with the biennial parameter).
Each season is univocally associated to one, and only one field, thus allowing to have only one season per yeargroup.
In most of the POST of the different types of labour, a season can be identified with its respective ID but also with the ID of the field it belongs to and its yeargroup.
Status
In the different labour APIs, you will find the status of the labour.
ID | Status |
---|---|
1 | Planned |
2 | Executed |
3 | Cancelled |
APIs
GET
To get the labours of the user making the query.
The View season feature is required in order to use it.
GET /registro_campo/labores/v2
It is possible to filter and paginate the results by adding the following parameters to the url:
estancia
: integer, corresponds to the id of the farm. If not included, the labour of all farms is searched.page_size
: integer, corresponds to the page size (number of labours to be searched).page
: integer, corresponds to the page number.campana
oryeargroup
: (optional) integer, corresponds to the yeargroup. The seasons of this yeargroup will be searched. By default, the current year is taken. If both parameters are set, just theyeargroup
parameter will be considered.fields
: (optional) string, comma separated list of field ids.labors
: (optional) string, comma separated list of labors ids to filter.date_from
: (optional) string, date from which labors are going to be fetched. Format: 'yyyy/mm/dd'date_to
: (optional) string, date until which labors are going to be fetched. Format: 'yyyy/mm/dd'status
: (optional) integer, status id of labor to be filtered. See estadoscrops_id
: (optional) string, comma separated list of crops ids of the labors to be filtered.
Response example:
{
"pagination": {
"total_pages": 1,
"page": null
},
"data": [
{
"inputs": null,
"uuid": "b05e28f4-c978-11ea-9329-9ba9b625615a",
"campaign": 28996,
"status_id": 1,
"farm": 28191,
"type_id": 2,
"type_name": "cosecha",
"field": 106350,
"completion_date": null,
"labour": 3210,
"status_name": "planificado",
"observations": null,
"yeargroup": 2020,
"date": "2020-07-24T00:00:00Z",
"specific_data": {
"quality": null,
"yield": null,
"unit": null,
"humidity": null
}
},
{
"inputs": [
{
"user_input": true,
"uuid": "7feb455a-c9e9-11ea-9329-cbd4ddaf2136",
"density": null,
"company": null,
"dose": 23,
"state": null,
"observations": null,
"components": [],
"composition": null,
"type": null,
"id": 25354,
"unit": "lt/ha",
"name": "2,4 D"
},
{
"user_input": true,
"uuid": "b967c668-ca3a-11ea-9329-8fb5d7f404f2",
"density": null,
"company": null,
"dose": 123,
"state": null,
"observations": null,
"components": [],
"composition": null,
"type": null,
"id": 25369,
"unit": "lt/ha",
"name": "Advance"
}
],
"uuid": "ac0c02d0-c83d-11ea-94c0-17a497d78233",
"campaign": 28996,
"status_id": 1,
"farm": 28191,
"type_id": 3,
"type_name": "siembra",
"field": 106350,
"completion_date": null,
"labour": 20071,
"status_name": "planificado",
"observations": "",
"yeargroup": 2020,
"date": "2020-07-17T00:00:00Z",
"specific_data": {
"sowed_area": null,
"crop_variety_id": 34166,
"actual_seed_rate_unit": null,
"is_cover_crop": false,
"target_yield_value": null,
"crop_variety_name": "Prueba",
"seed_rate_value": null,
"crop_name": "Algodón",
"row_width_value": null,
"actual_seed_rate_value": null,
"row_width_unit": null,
"target_yield_unit": null,
"crop_id": 1,
"seed_rate_unit": null
}
}
]
}
Attach files
Sometimes, it might be useful to attach files to a specific labor. This can be done by uploading files to the web and then attaching them to labors.
Attachments
POST
Upload an image or file to the platform.
Content-Type: application/x-www-form-urlencoded
POST /attachments
On the form include:
source
:Object
{ feature: "SIEMBRA", id: labour_id }
.Feature
: labor type,id
: labor id.file
:File
file to upload.uuid
:String
uuid asociated to the file. If not included, uuid will be generated automatically.
Sowings
Crops
The crops and their varieties are registered in the platform independently for each user, allowing each user to define the list according to his or her needs.There are also pre-loaded crops, these are the same for any user, and therefore cannot be altered.
In the PATCH and POST requests of a sowing, the crop and its variety are defined in a specific way.
First of all, it should be noted that it is not necessary to define the variety when loading a crop, but it is mandatory to indicate the crop if a variety is defined.
As can be seen in the list below, existing crops can be used or new ones can be created directly in the same form. same form. The same applies when specifying a variety for the crop.
Crops:
crop
:integer
, corresponds to the crop ID, when you want to use an existing crop.
or alternatively,
crop
:json
, corresponds to the crop data, when you want to register a new crop *name
:string
, name of the crop to be created.
Varieties:
variety
:integer
, corresponds to the ID of an existing variety
or alternatively,
variety
:json
, corresponds to the variety data, when you want to register a new variety. _name
:string
, name of the variety to create _weight_x_thousand_seeds
:float
, weight of thousand seeds
APIs
POST
Creation of a new sowing_labour.
The Create Labour feature is required to be able to use it.
Content-Type: application/json
POST /registro_campo/siembra
The same labour can be loaded in more than one season, thus facilitating the registration of activities that apply to more than one field, with the same parameters. Internally this generates the creation of as many labours as seasons are specified, using the same data for each one. Thus, this is an abstraction at the API level, but not an aspect of the internal data model (where a labour is associated with one and only one season).
In the body of the query, include the parameters:
uuids
:string array
, vector with UUIDs V1 (string) to identify the created labour(s)fields
:integer array
, vector with IDs of fields in which the labour will be recordedcampaigns
:integer array
, vector with season IDs (if no fields are specified)yeargroup
:integer
, year of the season (YYYYY)biennial
:boolean
, allows to define season name as Year/Year+1 (e.g. 2019/20) or YYYYY (2019)status
:integer
, labour status (see status)date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, in case it is a completed labour (YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ)observations
:string
, free text field to record what you want to recordinputs
:array with jsons
, the list of inputs used (see detail)crop
:integer or json
, crop sown (see section crops)variety
:integer or json
, crop variety (see section crops)is_cover_crop
:boolean
, determines if it is a cover croptarget_yield
:json
, expected yieldvalue
:float
, expected yield amountunit
:string
, expected yield unit of measure
seed_rate
:json
, expected sowing densityvalue
:float
, sowing density valueunit
:string
, unit of measurement of the sowing rate
sowed_area
:float
, sowed areaactual_seed_rate
:float
, sowing density obtainedvalue
:float
, sowing density valueunit
:string
, unit of measurement of the sowing density
row_width
:json
, sowing widthvalue
:float
, value of the sowing widthunit
:string
, unit of measurement of the seed width
attachments
:string array
, vector with uuids of attachments
It is mandatory to specify at least one field or at least one season in which to assign the sowing, the remaining parameters can be left out, the default values being:
uuids
: are generated automatically.yeargroup
: current yearbiennial
: Truestatus
: 2date
: current date- The rest are set to NULL.
Response example:
{
"res": "Siembra creada exitosamente",
"harvests": [2569, 2570, 2571],
"campaigns": [27899, 27900, 27901],
"denied_fields": [],
"supplies": null,
"created_labours": [
{
"field_id": 1000,
"labour_uuid": "100aa6ec-4e99-11eb-a4c9-b788d7fc2392",
"campaign_id": 27899
},
{
"field_id": 1001,
"labour_uuid": "100aa6ed-4e99-11eb-a4c9-0f9cea993a10",
"campaign_id": 27900
},
{
"field_id": 1002,
"labour_uuid": "100aa6ed-4e99-11eb-a4c9-0f9cea114f50",
"campaign_id": 27901
}
]
}
Extra parameters will also be observed in the responses. These are kept for backward compatibility but are contained in the above-mentioned and can therefore be ignored.
Specific errors
Código | Descripción |
---|---|
1 | Without authorization |
2 | Wrong crop |
93,94,95,96,97 | Internal errors in the creation of inputs |
PATCH
Modification of a sowing.
The Modify Labour feature is required to be able to use it.
Content-Type: application/json
PATCH /registro_campo/siembra
Unlike the POST request, in this case it is not possible to operate on more than one labour at the same time.
Include in the body of the query the parameters:
uuid
:string
, UUID of the labour to be modifiedcampaign
:integer
ID of the new seasonstatus
:integer
, 1: planned, 2: executed, 3: cancelleddate
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZobservations
:string
, free text fieldinputs
:array with jsons
, which was discussed above and whose details can be found hereattachments
:array with strings
, UUIDs array that contains the labour attachments.crop
:integer or json
, sown crop (see section crops)variety
:integer or json
, crop variety (see section crops)is_cover_crop
:boolean
, determines if it is a cover croptarget_yield
:json
, expected yieldvalue
:float
, expected yield amountunit
:string
, expected yield unit of measure
seed_rate
:json
, expected sowing densityvalue
:float
, seeding density valueunit
:string
, unit of measurement of the sowing rate
sowed_area
:float
, sowed areaactual_seed_rate
:float
, sowing density obtainedvalue
:float
, sowing density valueunit
:string
, unit of measurement of the sowing density
row_width
:json
, sowing widthvalue
:float
, value of the sowing widthunit
:string
, unit of measurement of the sowing width
attachments
:string array
, vector with uuids of attachments
It is mandatory to include the entire object, with modified values.
Response example:
{
"status": "harvest updated successfully",
"uuid": null,
"result": "OK",
"id": 2569
}
Specific errors
Code | Description |
---|---|
1 | Without authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
GET
There are two ways to obtain sowing information. First of all, we can obtain a list of sowings with their respective information through /sowings
endpoint. On the other hand, with /field_record/seeding
we can get a complete object for a specific seeding.
Sowings list
GET /siembras
Different parameters can be sent in the query string to filter and order:
id_lote
: To filter the sowings according to the field.id_campo
: To filter the sowings according to the farm.yeargroup
: To filter the sowings according to the year.id_cultivo
: To filter the sowings according to the crop.order
: To order the sowings in an ascending or descending way according to the date. Receivesasc
ordesc
, withdesc
being the default value.limit
: Receives a number that limits the number of seedings brought.
Example:
fetch("https://api.auravant.com/api/siembras?id_lote=1000&limit=2",{
method: "GET"
})
.then(response => response.json())
.then(result => console.log(result))
It should bring the last 2 seedings from the field which id is '1000'
Response example:
{
"data": [
{
"nombre_cultivo": "Trigo",
"id_cultivo": 21,
"densidad_lograda": null,
"yeargroup": 2030,
"fecha": "2022-06-20",
"unidad_medida_densidad": null,
"nombre_variedad": null,
"unidad_densidad_lograda": null,
"densidad": null,
"id_variedad": null,
"id_lote": 1000,
"sup_sembrada": null,
"id_ciclo": 32032,
"id": 19229
},
{
"nombre_cultivo": "sandía",
"id_cultivo": 1830,
"densidad_lograda": null,
"yeargroup": 2030,
"fecha": "2020-06-15",
"unidad_medida_densidad": null,
"nombre_variedad": null,
"unidad_densidad_lograda": null,
"densidad": null,
"id_variedad": null,
"id_lote": 1000,
"sup_sembrada": null,
"id_ciclo": 45153,
"id": 33749
}
}
Sowing
List of all the data associated with a sowing registered by the user.
In order to use this API, the View season feature is required.
Content-Type: text/plain
GET /registro_campo/siembra
URL parameters:
uuid
:string
, UUID de la siembra
Response example:
{
"sowed_area": null,
"crop_variety_id": null,
"campaign": 1311,
"type_id": 3,
"completion_date": null,
"labour_id": 168,
"row_width_value": null,
"crop_name": "Trigo",
"crop_variety_name": null,
"type_name": "siembra",
"actual_seed_rate_unit": null,
"observations": null,
"target_yield_unit": null,
"status": 1,
"attachments":[],
"inputs": {
"15229": {
"user_input": false,
"name": "cruiser advanced",
"density": null,
"company": "syngenta agro s.a.",
"dose": 15,
"state": null,
"observations": null,
"components": [
{
"uuid": "e8e97bb5-e20e-11ea-a16d-23c7dae43700",
"active_principle": true,
"eiq_1": null,
"concentration": 0.35,
"id": 33,
"name": "tiametoxam"
},
{
"uuid": "e8e97bb4-e20e-11ea-a16d-ebdaedeff6a3",
"active_principle": true,
"eiq_1": null,
"concentration": 0.15,
"id": 32,
"name": "tiabendazol"
},
{
"uuid": "e8e97ba7-e20e-11ea-a16d-1705dbd14fb4",
"active_principle": true,
"eiq_1": null,
"concentration": 0.025,
"id": 19,
"name": "fludioxonil"
},
{
"uuid": "e8e97bb0-e20e-11ea-a16d-bb27915bdad7",
"active_principle": true,
"eiq_1": null,
"concentration": 0.02,
"id": 28,
"name": "metalaxil m"
}
],
"composition": null,
"type": null,
"id": 15229,
"unit": "lt/ha",
"uuid": "aa406ac8-e248-11ea-a16d-83e4fa8cc682"
},
"1169": {
"user_input": false,
"name": "solmix",
"density": null,
"company": "bunge argentina s.a.",
"dose": 15,
"state": "líquido",
"observations": null,
"components": [
{
"uuid": "00339bb8-dc00-11ea-a16d-17092e797be4",
"active_principle": true,
"eiq_1": null,
"concentration": 0.28,
"id": 1,
"name": "n"
}
],
"composition": "28-0-0",
"type": "fertilizante",
"id": 1169,
"unit": "lt/ha",
"uuid": "bc77d2b8-dc04-11ea-a16d-e3b7ca4f6da8"
}
},
"is_cover_crop": false,
"target_yield_value": null,
"date": "2020-08-13T00:00:00Z",
"crop_id": 21,
"seed_rate_unit": null,
"row_width_measurement_unit": null,
"seed_rate_value": null,
"actual_seed_rate_value": null,
"labour_uuid": "e3bd479a-dda3-11ea-a16d-bbb02471ce59"
}
Specific errors
Code | Description |
---|---|
0 | Without authorization |
1 | General error |
DELETE
Deletion of a particular sowing.
The Delete Labour feature is required in order to use it.
Content-Type: text/plain
DELETE /registro_campo/siembra
URL parameters:
uuid
:string
, UUID de la siembra
Response example:
{
"res": "eliminado",
"result": "labour deleted",
"id": 25679
}
Specific errors
Code | Description |
---|---|
0 | Without authorization |
1 | General error |
Harvests
APIs
POST
Creation of a new harvesting _labour.
The Create Labour feature is required to be able to use it.
Content-Type: application/json
POST /registro_campo/cosecha
The same labour can be loaded in more than one season, thus facilitating the registration of activities that apply to more than one field, with the same parameters. Internally this generates the creation of as many labours as seasons are specified, using the same data for each one. Thus, this is an abstraction at the API level, but not a feature of the internal data model (where a labour is associated with one and only one season).
In the body of the query, include the parameters:
uuids
:string array
, vector with UUIDs V1 (string) to identify the created labour(s)fields
:integer array
, vector with IDs of fields in which the labour will be recordedcampaigns
:integer array
, vector with season IDs (if no fields are specified)yeargroup
:integer
, year of the season (YYYYY)biennial
:boolean
, allows to define season name as Year/Year+1 (e.g. 2019/20) or YYYYY (2019)status
:integer
, labour status (see status)date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, in case it is a completed labour (YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ)observations
:string
, free text field to record what you want to recordinputs
:array with jsons
, the list of inputs used (see detail)yield
:float
, yield obtained in the harvestunit
:string
, unit of measurement of yield.humidity
:float
, humidity at harvestingquality
:string
, free text field for recording the quality obtained
It is mandatory that at least one field or at least one season is specified in which to assign the harvest, the remaining parameters can be left out, the default values being:
uuids
: are generated automatically.yeargroup
: current yearbiennial
: Truestatus
: 2date
: current date- The rest are set to NULL.
Response Example:
{
"res": "Cosecha creada exitosamente",
"harvests": [2569, 2570, 2571],
"campaigns": [27899, 27900, 27901],
"denied_fields": [],
"supplies": null,
"created_labours": [
{
"field_id": 1000,
"labour_uuid": "4e56951b-652a-11ea-bd20-8fc732719012",
"campaign_id": 27899
},
{
"field_id": 1001,
"labour_uuid": "4e56951c-652a-11ea-bd20-034910106182",
"campaign_id": 27900
},
{
"field_id": 1002,
"labour_uuid": "4e569526-652a-11ea-bd20-2b7c9ee21e33",
"campaign_id": 27901
}
]
}
Extra parameters will also be observed in the responses. These are kept for backward compatibility but are contained in the above-mentioned and can therefore be ignored.
Specific errors
Code | Description |
---|---|
1 | Without authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
PATCH
Modification of a harvest.
The Modify Labour feature is required to be able to use it.
Content-Type: application/json
PATCH /registro_campo/cosecha
Unlike the POST request, in this case it is not possible to operate on more than one labour at the same time.
Include in the body of the query the parameters:
uuid
:string
, UUID of the labour you want to modify.id
:integer
, ID of the labour to be modifiedcampaign
:integer
, ID of the new seasonattachments
:array with strings
, UUIDs array that contains the labour attachments.status
:integer
, 1: planned, 2: executed, 3: cancelleddate
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZobservations
:string
, free text fieldinputs
:array with jsons
, discussed in the preceding paragraphs, details of which can be found hereyield
:float
, yield obtained in the harvestunit
:string
, unit of measurement of yield.humidity
:float
, humidity at harvestingquality
:string
, free text field for recording the quality obtained
It is mandatory to include the entire object, with modified values.
Response example:
{
"status": "harvest updated successfully",
"uuid": null,
"result": "OK",
"id": 2569
}
Specific errors
Code | Description |
---|---|
1 | Without authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
GET
List of all the data associated with a harvest registered by the user.
In order to use this API, the View Season feature is required.
Content-Type: text/plain
GET /registro_campo/cosecha
URL Parameters:
uuid
:string
, harvest UUID
Response example:
{
"status": 1,
"inputs": {
"1170": {
"user_input": false,
"name": "cloruro de potasio cofco intl",
"density": null,
"company": "cofco international argentina s.a.",
"dose": 3,
"state": "granulado",
"observations": null,
"components": [
{
"uuid": "00339bba-dc00-11ea-a16d-bb9b85708912",
"active_principle": true,
"eiq_1": null,
"percentage": "0.5",
"id": 3,
"name": "K"
}
],
"composition": "0-0-50",
"type": "fertilizante",
"id": 1170,
"unit": "lt/ha",
"uuid": "bc77d2b9-dc04-11ea-a16d-ab222b5d6525"
}
},
"campaign": 1303,
"type_id": 2,
"labour_uuid": "c9d6eae4-dda2-11ea-a16d-a7301cf737fd",
"type_name": "cosecha",
"yield": 0.0,
"completion_date": null,
"observations": "qwerty short text",
"labour_id": 507,
"date": "2020-08-13T00:00:00Z",
"quality": "",
"unit": "tn/ha"
}
Specific errors
Code | Description |
---|---|
0 | Without authorization |
1 | General error |
DELETE
Deletion of a particular harvest.
The Delete Labour feature is required in order to use it.
Content-Type: text/plain
DELETE /registro_campo/cosecha
URL parameters:
uuid
:string
, harvest UUID
Response example:
{
"res": "eliminado",
"result": "labour deleted",
"id": 25679
}
Applications
Types
Any application can be associated with a particular type, this being merely optional and for information purposes.
ID | Type |
---|---|
1 | Herbicide |
2 | Fungicide |
3 | Insecticide |
4 | Fertilizer |
5 | Amendment |
APIs
POST
Creation of a new application_labour.
The Create Labour feature is required to be able to use it.
Content-Type: application/json
POST /registro_campo/aplicacion
The same labour can be loaded in more than one season, thus facilitating the registration of activities that apply to more than one field, with the same parameters. Internally this generates the creation of as many labours as seasons are specified, using the same data for each one. Thus, this is an abstraction at the API level, but not a attribute of the internal data model (where a labour is associated with one and only one season).
In the body of the query, include the parameters:
uuids
:string array
, vector with UUIDs V1 (string) to identify the created labour(s).fields
:integer array
, vector with IDs of fields in which the labour will be recordedcampaigns
:integer array
, vector with seasons IDs (if no fields are specified)yeargroup
:integer
, year of the season (YYYYY)biennial
:boolean
, allows to define season name as Year/Year+1 (e.g. 2019/20) or YYYYY (2019)status
:integer
, labour status (see status)date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, in case it is a completed labour (YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ)observations
:string
, free text field to record what you want to recordinputs
:array with jsons
, the list of inputs used (see detail)category
:integer
, type ID of application (see types of applications)
It is mandatory to specify at least one field or at least one season to assign the application to, the remaining parameters can be left out, the default values being:
uuids
: are generated automatically.yeargroup
: current yearbiennial
: Truestatus
: 2date
: current date- The rest are set to NULL.
Response example:
{
"campaigns": [1355, 1356],
"applications": [567, 566],
"denied_fields": [],
"inputs": [1167, 1168, 1165, 1166],
"productos": [
{
"nombre": null,
"id": 1167
},
{
"nombre": null,
"id": 1168
},
{
"nombre": null,
"id": 1165
},
{
"nombre": null,
"id": 1166
}
],
"res": "Aplicación creada exitosamente",
"id_ciclo": 1355,
"id": 567,
"created_labours": [
{
"field_id": 2000,
"labour_uuid": "4e569523-652a-11ea-bd20-2bbd8b3ef0fb",
"campaign_id": 1355
},
{
"field_id": 2001,
"labour_uuid": "4f2026b4-7806-11ea-bd20-43282af2676a",
"campaign_id": 1356
}
]
}
Specific errors
Code | Description |
---|---|
1 | Without Authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
PATCH
Modification of an application.
The Modify Labour feature is required in order to use it.
Content-Type: application/json
PATCH /registro_campo/aplicacion
Unlike the POST request, in this case it is not possible to operate on more than one labour at the same time.
Include in the query body the parameters:
-
uuid
:string
, UUID of the labour you want to modify. -
id
:integer
, ID of the labour to be modified -
campaign
:integer
, ID of the new season -
status
:integer
, 1: planned, 2: executed, 3: cancelled -
date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ -
attachments
:array with strings
, UUIDs array that contains the labour attachments. -
completion_date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ -
observations
:string
, free text field -
inputs
:array with jsons
, discussed in the preceding paragraphs, details of which can be found here -
category
:integer
, type ID of application (see application types)It is mandatory to include the entire object, with modified values.
Specific errors
Code | Description |
---|---|
1 | Without authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
GET
Listing of an application registered by the user.
In order to use this API, the View Season feature is required.
Content-Type: text/plain
GET /registro_campo/aplicacion
URL parameters:
uuid
:string
, UUID of the application
Response example:
{
"status": 1,
"inputs": {
"1078": {
"user_input": true,
"name": "input_front_10",
"density": null,
"company": null,
"dose": 1010,
"state": null,
"observations": null,
"components": [],
"composition": null,
"type": null,
"id": 1078,
"unit": "lt/ha",
"uuid": "5b6a2767-8357-11ea-bd20-dbb8b3e04708"
},
"1079": {
"user_input": true,
"name": "input_front_11",
"density": null,
"company": null,
"dose": 1111,
"state": null,
"observations": null,
"components": [],
"composition": null,
"type": null,
"id": 1079,
"unit": "lt/ha",
"uuid": "5b6a2768-8357-11ea-bd20-73c5d15c4dca"
}
},
"campaign": 1317,
"type_id": 1,
"labour_uuid": "5b6a2762-8357-11ea-bd20-0384d11c975b",
"type_name": "aplicacion",
"completion_date": null,
"observations": "rolo - front web",
"labour_id": 516,
"date": "2020-04-20T00:00:00Z",
"category_id": null,
"category_name": null
}
Specific errors
Code | Description |
---|---|
0 | Withour authorization |
1 | General error |
DELETE
Deleting an application.
The Delete Labour feature is required in order to use it.
Content-Type: text/plain
DELETE /registro_campo/aplicacion
URL parameters:
uuid
:string
, UUID of the application
Response example:
{
"res": "eliminado",
"result": "labour deleted",
"id": 25679
}
Other labours
Types
It is needed to know the other labours types, to identify another labour apart from application, sow and harvest
GET /registro_campo/tipos_labores
Response example:
[
{
"nombre": "Transplante",
"id_tipo": 1
},
{
"nombre": "Raleo",
"id_tipo": 2
},
{
"nombre": "Recolección",
"id_tipo": 3
}
]
NOTE - The response example do not have all types of other labours and those can change or be updated, so that it's necessary to get them from the endpoint.
Costs types
This endpoint returns costs types for other labours
GET /registro_campo/tipos_costos_otros_labores
Response example:
[
{
"nombre": "aplicacion",
"id": 0
},
{
"nombre": "mano de obra",
"id": 1
}
]
APIs
POST
Creation of a new labour of different type.
The Create Labour feature is required to be able to use it.
Content-Type: application/json
POST /registro_campo/otroslabores
The same labour can be loaded in more than one season, thus facilitating the registration of activities that apply to more than one field, with the same parameters. Internally this generates the creation of as many labours as seasons are specified, using the same data for each one. Thus, this is an abstraction at the API level, but not a attribute of the internal data model (where a labour is associated with one and only one season).
In the body of the query, include the parameters:
uuids
:string array
, vector with UUIDs V1 (string) to identify the created labour(s).fields
:integer array
, vector with IDs of fields in which the labour will be recordedcampaigns
:integer array
, vector with seasons IDs (if no fields are specified)yeargroup
:integer
, year of the season (YYYYY)biennial
:boolean
, allows to define season name as Year/Year+1 (e.g. 2019/20) or YYYYY (2019)status
:integer
, labour status (see status)date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZcompletion_date
:string
, in case it is a completed labour (YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZ)observations
:string
, free text field to record what you want to recordinputs
:array with jsons
, the list of inputs used (see detail)tipo_otro_labor
:integer
,required
, labour type (min: 0)(see typessuperficie_real
:number
, real surface valueunidad_medida
:text
, real surface unitextra_cost
:object
, extra labour costsmateriales
:object
, materials costsvalue
:integer
, cost valueunit
:string
, currency unit
labour_cost
:object
, cost and cost typelabour_type
:integer
, cost type (see detail)unit
:string
, currency unitvalue
:integer
, value
It is mandatory to specify at least one field or at least one season to assign the other labour to, the remaining parameters can be left out, the default values being:
uuids
: are generated automatically.yeargroup
: current yearbiennial
: Truestatus
: 2date
: current date- The rest are set to NULL.
Response example:
{
"campaigns": [
65824
],
"inputs": null,
"other_labour": [
957
],
"denied_fields": [],
"productos": [],
"res": "Labor creada exitosamente",
"id_ciclo": 65824,
"id": 957,
"created_labours": [
{
"labour_uuid": "298ce4de-e828-11ec-835a-9fdfc0b1c03e",
"field_id": 245584,
"campaign_id": 65824
}
]
}
Specific errors
Code | Description |
---|---|
1 | Without Authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
PATCH
Modification of other labour.
The Modify Labour feature is required in order to use it.
Content-Type: application/json
PATCH /registro_campo/otroslabores
Unlike the POST request, in this case it is not possible to operate on more than one labour at the same time.
Include in the query body the parameters:
uuid
:string
,required
, UUID of the labour you want to modify.id
:integer
, ID of the labour to be modifiedcampaign
:integer
, ID of the new seasonstatus
:integer
, 1: planned, 2: executed, 3: cancelleddate
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZattachments
:array with strings
, UUIDs array that contains the labour attachments.completion_date
:string
, YYYYY-MM-DD or YYYYY-MM-DDTHH:MM:SSZobservations
:string
, free text fieldinputs
:array with jsons
, discussed in the preceding paragraphs, details of which can be found heretipo_otro_labor
:integer
, labour type (min: 0)(see typessuperficie_real
:number
, real surface valueunidad_medida
:text
, real surface unitextra_cost
:object
, extra labour costsmateriales
:object
, materials costsvalue
:integer
, cost valueunit
:string
, currency unit
labour_cost
:object
, cost and cost typelabour_type
:integer
, cost type (see detail)unit
:string
, currency unitvalue
:integer
, value
It is mandatory to include in parameter uuid. Any other parameter should be provided only if it is to be modified.
Ejemplo de respuesta:
{
"status": "labour updated successfully",
"inputs": {
"deleted": [],
"updated": [],
"created": []
},
"uuid": "65be9cc8-e8bd-11ec-835a-1b84e4d36150",
"res": "updated",
"result": "OK",
"id": null
}
Specific errors
Code | Description |
---|---|
1 | Without authorization |
93,94,95,96,97 | Internal errors in the creation of inputs |
GET
Listing of an other labour registered by the user.
In order to use this API, the View Season feature is required.
Content-Type: text/plain
GET /registro_campo/otroslabores
URL parameters:
uuid
:string
,required
, UUID of the other labour
Response example:
{
"status": 1,
"inputs": null,
"attachments": "{}",
"campaign": 65824,
"type_id": 4,
"superficie_real": 190.0,
"labour_uuid": "65be9cc8-e8bd-11ec-835a-1b84e4d36150",
"type_name": "otros labores",
"ha_reales": 0.0,
"completion_date": null,
"costs": {
"inputs": {},
"materiales": {
"value": 0,
"unit": "R$/ha"
},
"aplicacion": {},
"mano_de_obra": {},
"seed": {},
"labour": {
"labour_type": 0,
"value": "0.00",
"unit": "R$/ha"
}
},
"observations": "",
"labour_id": 967,
"date": "2022-06-08T00:00:00Z",
"id_tipo_otro_labor": 2,
"unit": "ha",
"resources": "{}"
}
Specific errors
Code | Description |
---|---|
0 | Withour authorization |
1 | General error |
DELETE
Deleting any other labour.
The Delete Labour feature is required in order to use it.
Content-Type: text/plain
DELETE /registro_campo/otroslabores
URL parameters:
uuid
:string
,required
, UUID of the other labour
Response example:
{
"result": "labour deleted",
"id": 967,
"uuid": "65be9cc8-e8bd-11ec-835a-1b84e4d36150"
}