Compare commits

...

60 Commits

Author SHA1 Message Date
56f4e66e68 Update Blight-API.md 2024-09-23 06:35:36 +00:00
27a44658e3 Update 'Polling-task-status.md' 2023-05-09 13:19:24 +00:00
e0190575ae Update 'Polling-task-status.md' 2023-05-09 13:19:03 +00:00
4630426de1 Update 'Blight-API.md'
more text
2023-02-22 15:34:17 +00:00
f8a0e2f5d9 Update 'Blight-API.md'
Added extra step
2023-02-22 15:32:22 +00:00
49f9418bc5 Update 'Blight-API.md' 2021-08-27 19:26:14 +00:00
9ce1c7748a Update 'Create-b-cropfield.md' 2021-08-27 19:25:30 +00:00
c9f5fc00b9 Update 'Create-b-cropfield.md' 2021-08-27 19:23:50 +00:00
3763bb735e Added croppinscheme step 2021-08-27 13:18:19 +02:00
c991c340aa Merge branch 'master' of https://git.akkerweb.nl/FarmMaps/Documentatie 2021-08-26 14:04:04 +02:00
a316a4a0b6 Add croppingscheme as child of croppingscheme 2021-08-26 14:03:34 +02:00
ee854241a1 Update 'Blight-API.md' 2021-08-26 11:15:39 +00:00
de2aa45a79 Update 'Authentication.md' 2021-08-26 11:13:34 +00:00
94586342ee Blight API first draft 2021-06-07 20:59:25 +02:00
b4e792e259 Update 'Blight-API.md' 2021-06-03 11:48:20 +00:00
08b75f2466 Update 'README.md' 2021-06-03 11:16:13 +00:00
30192efae5 Update 'README.md' 2021-06-03 11:15:46 +00:00
23f430cd5f Update 'README.md' 2021-06-03 10:54:36 +00:00
d184c4b194 Update 'Blight-API.md' 2021-05-28 14:58:47 +00:00
bd57ff9ece Add 'Blight-API.md' 2021-05-28 14:16:01 +00:00
dc99601a17 Update 'Shape-to-geotiff.md' 2021-04-29 07:23:07 +00:00
be9bafbe27 Update 'Shape-to-geotiff.md' 2021-04-29 06:54:54 +00:00
ce6f977b9b Update 'VRAHaulmkilling-API.md' 2021-04-29 06:34:08 +00:00
21e4b084c6 Update 'VRANbs-API.md' 2021-04-29 06:33:34 +00:00
06e37088c1 Add 'Shape-to-geotiff.md' 2021-04-29 06:32:31 +00:00
8d59919434 Update 'VRAHerbicide-API.md' 2021-04-29 06:32:18 +00:00
7fc3ef5138 Update 'VRAPoten-API.md' 2021-04-14 17:33:58 +00:00
a31c8be83e Update 'VRAHerbicide-API.md' 2021-04-14 12:07:58 +00:00
40f81e8098 Update 'VRAHaulmkilling-API.md' 2021-04-11 15:36:41 +00:00
9cebe41857 Update 'VRAHaulmkilling-API.md' 2021-04-11 14:44:13 +00:00
5168f79d5b 'VRAHaulmkilling-API.md' updaten
fix swagger url
2021-03-06 08:39:32 +00:00
243d06978c 'VRAHerbicide-API.md' updaten
fix swagger url
2021-03-06 08:39:01 +00:00
9af31524b2 'VRANbs-API.md' updaten
Fix swagger url
2021-03-06 08:38:32 +00:00
0895d3ecf5 'VRAPoten-API.md' updaten
Adjust swagger url
2021-03-06 08:37:42 +00:00
dad850f8a7 Update 'VRAPoten-API.md' 2021-03-05 20:51:42 +00:00
9e4bad55be Update 'VRAPoten-API.md' 2021-03-05 20:51:04 +00:00
71b43fc067 Update 'VRAHaulmkilling-API.md' 2021-03-03 12:01:16 +00:00
41f21e57df Update 'VRAHerbicide-API.md' 2021-03-03 12:00:51 +00:00
ced16c70dc Update 'VRANbs-API.md' 2021-03-03 12:00:21 +00:00
ffd4fa5d1b Update 'VRAPoten-API.md' 2021-02-25 10:46:23 +00:00
8337df7c63 Update 'VRAPoten-API.md' 2021-02-25 10:44:36 +00:00
01e3e01920 Update 'Create-Taskmap.md' 2021-02-15 09:28:44 +00:00
2962c87d24 Update 'Create-Taskmap.md' 2021-02-15 08:51:39 +00:00
27d62efffb Update 'Create-Taskmap.md' 2021-02-10 20:29:52 +00:00
7a8420273a Update 'Create-Taskmap.md' 2021-02-10 19:15:31 +00:00
ae07a10e7e Update 'Create-Taskmap.md' 2021-02-10 19:15:23 +00:00
43aaad44ec Update 'VRANbs-API.md' 2020-07-07 20:23:11 +00:00
3f16f491df Update 'VRANbs-API.md' 2020-07-07 20:16:05 +00:00
8ccef5e9f9 Update 'VRANbs-API.md' 2020-07-07 20:15:27 +00:00
17498e26cf Update 'VRAHerbicide-API.md'
Improved herbicide documentation with latest changes
2020-06-10 12:38:50 +00:00
5b72805644 Update 'Polling-task-status.md'
udpdated item task state description
2020-05-22 09:51:33 +00:00
9bc15fef76 changed download data api for vra documentation 2020-05-12 17:09:27 +02:00
9b23942afa fixed placement of extra explanation of attribute input parameters. 2020-05-11 12:44:52 +02:00
712026d9ae Added example for extra attribute parameters. 2020-05-11 12:42:31 +02:00
8392b30e40 Added description for extra optional attribute parameters. 2020-05-11 12:40:00 +02:00
6aa98c3d02 Added extra explanation of input parameters. 2020-05-11 12:19:49 +02:00
d2f7c089dc renamed some herbicide names to haulmkilling 2020-05-11 09:47:55 +02:00
248ab25700 fixed haulmkilling api documentation md file. 2020-05-11 09:45:40 +02:00
85641e652d first draft haulmkilling API documentation 2020-05-11 09:44:46 +02:00
Mark van der Wal
c46574580b renamed Home to README 2020-05-07 18:46:02 +02:00
12 changed files with 1719 additions and 723 deletions

View File

@@ -1,14 +1,14 @@
## Autentication
Farmmaps uses OpenID-connect: https://openid.net/connect/
It is recommended to use a library to facilitate the authentication.
To get the openid configuration call the following url: https://accounts.farmmaps.awtest.nl/.well-known/openid-configuration
The user could also use the openid-configuration to handle authentication by themselves.
https://identitymodel.readthedocs.io/en/latest/native/overview.html
The token received needs to be used in the request header.
>'Authorization': 'bearer {token}'
The token can also easily be created through the swagger documentation:
https://farmmaps.awtest.nl/swagger/index.html
## Autentication
Farmmaps uses OpenID-connect: https://openid.net/connect/
It is recommended to use a library to facilitate the authentication.
To get the openid configuration call the following url: https://accounts.farmmaps.eu/.well-known/openid-configuration
The user could also use the openid-configuration to handle authentication by themselves.
https://identitymodel.readthedocs.io/en/latest/native/overview.html
The token received needs to be used in the request header.
>'Authorization': 'bearer {token}'
The token can also easily be created through the swagger documentation:
https://farmmaps.eu/swagger/index.html

497
Blight-API.md Normal file
View File

@@ -0,0 +1,497 @@
# Blight API
[<< Home](README.md)
For the currently available public FarmMaps API you can take a look at swagger: https://farmmaps.eu/swagger
## API flow
* Authenticate
* Create cropping scheme (if not exists)
* Create crop field (if not exists)
* Get blight advice
* Create blight advice
* Add spray
* Add irrigation
* Get predefined fungicides
## Steps
### Authenticate
See [Authentication](Authentication.md)
### Create cropping scheme (if not exists)
See [Create Croppingscheme](Create-Croppingscheme.md)
### Create crop field (if not exists)
See [Create Cropfield](Create-b-cropfield.md)
### <a name="create-advice"></a>Get blight advice
Blight is only available for potato fields.
The advice is automatically created when new potato fields are added and is scheduled to be updated at configured times.
It is also possible to create a new advice at any time, see [Create blight advice](#create-advice).
A blight advice is a child record of a crop field.
Use the crop field code to get the latest blight advice.
#### 1. get the blight item code
> Request
```javascript
GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight
```
> Response 200 OK
```javascript
[
{
"parentCode": "string",
"geometry": ...
"url": ...
"code": ...
"size": ...
"data": {
"itemtask": {
"runs": {
"last": "2023-02-22T03:02:01.8775194Z",
"success": "2023-02-22T03:02:01.8775194Z"
},
"state": "ok",
"messages": []
},
...
}
```
> Response 404 Not Found
There is no advice available, try to create a new advice, see [Create blight advice](#create-advice).
Check the data field for itemtask/state. If state is "ok" there should be an advice.
#### 2. get advice for the blight item
Use the code found in the previous call (or use url) to get the advice.
> Request
```javascript
GET /api/v1/items/{code}/data
```
> Response 200 OK
```javascript
[
{
"sprayTime": null,
"date": "2022-03-01T00:00:00",
"weather": [
{
"temperature": 3.0,
"precipitation": 0.0,
"rain": 0.0,
"irrigation": 0.0,
"humidity": 71.0,
"hh": 0,
"leafwetnessmm": null
},...
}
```
> Response 404 Not Found
### <a name="create-advice"></a>Create blight advice
Task 'vnd.farmmaps.task.blight' must be executed to create an advice.
This task is automatically created for potato fields and is scheduled to run at configered times to keep the advice updated. But it is possible to create this task at any time.
Add the crop field code to the URL and execute the following request.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"TaskType": "vnd.farmmaps.task.blight",
"Delay": null,
"attributes": {}
}
```
> Response 200
```javascript
{
"code": "{code}",
"taskType": "vnd.farmmaps.task.blight",
"attributes": {
"messagePriority": "10"
}
}
```
With the code in the response message and the code of the crop field, it is possible to check the task's state (error/ok/scheduled/processing). See [Check task status](Polling-task-status.md).
### Add spray
Sprays are stored as child item of a blight item.
This item also contains other parameters like pressure, disable/enable oospores and risc on tuber infection, wich are all used when the advice is created.
Changing these parameters will not create in a new advice automatically.
But is it possible to create an advice at any time, see [Create blight advice](#create-advice).
Get the blight advice code from [Get blight advice](#create-advice)
Use this code in the following request.
> Request
```javascript
GET api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.user.input
```
> Response 200
```javascript
[
{
"code": "{code}",
// ....
"data": {
"sprays": [],
"phytoPressure": 0,
"ignoreOoSpores": true,
"ignoreTuberRisk": true,
"haulmKillingDate": null
}
}
```
Get the first object of the array, change the data, and push the object back.
Use the code from the response above.
```javascript
PUT /api/v1/items/{code}
{
"parentCode": "....",
// ....
"data": {
"sprays": [
{
"dose": 1,
"isVRA": false,
"fungicide": {
"ai1": "mandipropamid",
"ai2": null,
"ai3": null,
"code": "revus",
"name": "revus 0,6 l",
"maxdose": "0.6",
"mindose": "0.48",
"safedays": "3",
"emergence": true,
"newgrowth": "2",
"contentai1": "250",
"contentai2": "0",
"contentai3": "0",
"fastgrowth": true,
"contentunit": "g/l",
"rainfastness": "3",
"tuberfilling": false,
"aidescription": "mandipropamid (0.6 l/ha)",
"curativescore": "1",
"dryingtimemax": "1",
"dryingtimemin": "0.5",
"vracompatible": true,
"maxapplications": "6",
"preventivescore": "4",
"recommendeddose": "0.6",
"tuberprotection": "2",
"eradicativescore": "1.5",
"earlytubersetting": false,
"protectioncategory": "1",
"applicationrateunit": "l/ha",
"ctgbregistrationnumber": "12969 n"
},
"sprayTime": "2021-04-15T12:00:00Z"
}
],
"phytoPressure": 0,
"ignoreOoSpores": false,
"ignoreTuberRisk": true,
"haulmKillingDate": null
},
// ....
}
```
> Response 200
```javascript
{
"parentCode": "....",
// ....
}
```
# Blight API
[<< Home](README.md)
For the currently available public FarmMaps API you can take a look at swagger: https://farmmaps.eu/swagger
## API flow
* Authenticate
* Create cropping scheme (if not exists)
* Create crop field (if not exists)
* Get blight advice
* Create blight advice
* Add spray
* Add irrigation
* Get predefined fungicides
## Steps
### Authenticate
See [Authentication](Authentication.md)
### Create cropping scheme (if not exists)
See [Create Croppingscheme](Create-Croppingscheme.md)
### Create crop field (if not exists)
See [Create Cropfield](Create-b-cropfield.md)
### <a name="create-advice"></a>Get blight advice
Blight is only available for potato fields.
The advice is automatically created when new potato fields are added and is scheduled to be updated at configured times.
It is also possible to create a new advice at any time, see [Create blight advice](#create-advice).
A blight advice is a child record of a crop field.
Use the crop field code to get the latest blight advice.
#### 1. get the blight item code
> Request
```javascript
GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight
```
> Response 200 OK
```javascript
[
{
"parentCode": "string",
"geometry": ...
"url": ...
"code": ...
"size": ...
"data": {
"itemtask": {
"runs": {
"last": "2023-02-22T03:02:01.8775194Z",
"success": "2023-02-22T03:02:01.8775194Z"
},
"state": "ok",
"messages": []
},
...
}
```
> Response 404 Not Found
There is no advice available, try to create a new advice, see [Create blight advice](#create-advice).
Check the data field for itemtask/state. If state is "ok" there should be an advice.
#### 2. get advice for the blight item
Use the code found in the previous call (or use url) to get the advice.
> Request
```javascript
GET /api/v1/items/{code}/data
```
> Response 200 OK
```javascript
[
{
"sprayTime": null,
"date": "2022-03-01T00:00:00",
"weather": [
{
"temperature": 3.0,
"precipitation": 0.0,
"rain": 0.0,
"irrigation": 0.0,
"humidity": 71.0,
"hh": 0,
"leafwetnessmm": null
},...
}
```
> Response 404 Not Found
### <a name="create-advice"></a>Create blight advice
Task 'vnd.farmmaps.task.blight' must be executed to create an advice.
This task is automatically created for potato fields and is scheduled to run at configered times to keep the advice updated. But it is possible to create this task at any time.
Add the crop field code to the URL and execute the following request.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"TaskType": "vnd.farmmaps.task.blight",
"Delay": null,
"attributes": {}
}
```
> Response 200
```javascript
{
"code": "{code}",
"taskType": "vnd.farmmaps.task.blight",
"attributes": {
"messagePriority": "10"
}
}
```
With the code in the response message and the code of the crop field, it is possible to check the task's state (error/ok/scheduled/processing). See [Check task status](Polling-task-status.md).
### Late Blight Foliage Resistance settings
It is possible to delay the first spray application based on the cultivar resistance level (8 and 9).
These settings are stored on the user input item.
Get the blight advice code from [Get blight advice](#create-advice)
Use this code in the following request.
> Request
```javascript
GET api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.user.input
```
> Response 200
```javascript
[
{
"code": "{code}",
// ....
"data": {
"sprays": [],
"phytoPressure": 0,
"ignoreOoSpores": true,
"ignoreTuberRisk": true,
"haulmKillingDate": null,
"suppressSprayAdvice": false,
"infectionDate": null
}
}
```
Set the suppressSprayAdvice to true and enter the infectionDate when an infection in the region has spotted.
```javascript
PUT /api/v1/items/{code}
{
"parentCode": "....",
// ....
"data": {
// ....
"suppressSprayAdvice": true,
"infectionDate": "2024-09-02T22:00:00Z"
},
// ....
}
```
> Response 200
```javascript
{
"parentCode": "....",
// ....
}
```
### Add irrigation
Irrigations are stored as child item of a crop recording item.
First step is to get the crop recording item for the crop field.
#### 1. get the crop recording item for the crop field
> Request
```javascript
GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.crprec
```
> Response 200
```javascript
[
{
"code": "{code}",
// ....
"data":
{
}
}
```
#### 2. Add irrigation to the crop field
Use the crop recording code, got from the previous call, and change the desired fields (from, to, quantity, etc):
> Request
```javascript
POST /api/v1/items/
{
"data": {
"from": "2021-05-05T08:00:00.000Z",
"to": "2021-05-05T13:00:00.000Z",
"quantity": 80,
"name": "Irrigation",
"status": "3",
"method": "90100",
"contractor": false,
"operationCode": "9",
"product": "OW"
},
"parentCode": "{code}",
"itemType": "vnd.farmmaps.itemtype.crprec.operation",
"name": "CrpRec Operation, Irrigation"
}
```
### Get predefined fungicides
A list of predefined fungicides can be requested by getting the "vnd.farmmaps.itemtype.codelist.fm002" items from farmmaps.
> Request
```javascript
GET /api/v1/items/?it=vnd.farmmaps.itemtype.codelist.fm002
```
> Response 200
```javascript
[
{
"code": "...",
// ...
"data":
{
"ai1": "fluazinam",
"ai2": null,
"ai3": null,
"code": "shirlangold",
"name": "shirlan gold ",
"maxdose": "0.4",
"mindose": "0.32",
"safedays": "7",
"emergence": false,
"newgrowth": "0.5",
"contentai1": "500",
"contentai2": "0",
"contentai3": "0",
"fastgrowth": true,
"contentunit": "g/l",
"rainfastness": "2.5",
"tuberfilling": false,
"aidescription": "fluazinam (0.4 l/ha)",
"curativescore": "0",
"dryingtimemax": "2",
"dryingtimemin": "1",
"vracompatible": false,
"maxapplications": "10",
"preventivescore": "2.9",
"recommendeddose": "0.4",
"tuberprotection": "3.3",
"eradicativescore": "0",
"earlytubersetting": true,
"protectioncategory": "1",
"applicationrateunit": "l/ha",
"ctgbregistrationnumber": "14744 n"
}
},
...
]
```

37
Create-Croppingscheme.md Normal file
View File

@@ -0,0 +1,37 @@
## Create croppingscheme with the farmmaps API
* Create a 'vnd.farmmaps.itemtype.croppingscheme' item as a child of the 'USER_IN' item.
The data property can be used to add some information about the farm and the geometry can be used as location of the farm.
> Request
```javascript
POST /api/v1/items
{
"parentCode": "{USER_IN_item_code}",
"itemType": "vnd.farmmaps.itemtype.croppingscheme",
"name": "Name for the scheme",
"data": {},
"geometry": {"type":"Polygon","coordinates":[[[6.09942873984307,53.070025028087],[6.09992507404607,53.0705617890585],[6.10036959220086,53.0710679529031],[6.10065149010421,53.0714062774307],[6.10087493644271,53.0716712354474],[6.10091082982487,53.0716936039203],[6.10165087441291,53.0712041549161],[6.10204994718318,53.0709349338005],[6.10263143118855,53.0705789370018],[6.10311578125011,53.0702657538294],[6.10331686552072,53.0701314102389],[6.103326530575,53.070119463569],[6.10309137950343,53.0699829669055],[6.10184241586523,53.0692902201371],[6.10168497998891,53.0691984306747],[6.10092987659869,53.0694894453514],[6.09942873984307,53.070025028087]]]}
}
```
> Response 201 Created
```Javascript
{
"parentCode": "string",
"geometry": {},
"data": {},
"tags": [
"string"
],
"url": "string",
"code": "string",
"name": "string",
"created": "2019-12-18T10:16:21.455Z",
"updated": "2019-12-18T10:16:21.455Z",
"dataDate": "2019-12-18T10:16:21.455Z",
"itemType": "string",
"sourceTask": "string",
"size": 0,
"state": 0,
"thumbnail": true
}
```

View File

@@ -1,30 +1,77 @@
## Create taskmap
The user can use the "ItemTask" API to execute the TaskmapTask with the item code which contains the tiff data in {code}.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.taskmap"
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.taskmap",
"delay": "",
"attributes": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
This will create the item with shape data as a sibling of the input item.
## Create taskmap
The user can use the "ItemTask" API to execute the TaskmapTask with the cropfield item code in {code}.
{itemCode} should contain the item with tiff data.
**~! REMEMBER, creating a taskmap with a high resolution < 1 can take a considerable time (from minutes up to hours). !~**
**~! It helps to lower the precision to say 1 or 0 if a high resolution is needed. !~**
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.taskmap",
"attributes": {
"inputCode" "{itemCode}"
"operation": "shape", // currently only "shape" supported
"cellWidth": "10", // in metres
"cellHeight": "5", // in metres
"startPoint": "{
\"type\": \"Point\",
\"coordinates\": [6.014414493084948, 53.08996024180022]
}",
"endPoint": "{
\"type\": \"Point\",
\"coordinates\": [6.014997043859679, 53.090253715796308]
}"
}
}
```
* geojson is expected in WGS84, 4326 projection.
* endPoint is optional but angle or endPoint is needed!
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.taskmap"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
This will create the item with shape data as a sibling of the input item.
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayerName**
Allows you to specify which layer to use for an input item.
* **precision** default value of 2 decimals.
Caps the values to {precision} decimals after the .
* **endPoint** geojson geometry. (endpoint or angle is needed!)
point geometry
* **angle** value between 0.0 - 360.0. (endpoint or angle is needed!)
Orientation of the taskmap fishnet.
* **centered** true or false.
centers the abline in the middle of the 'cellWidth' axis.
Default percentile values for nbs are 0.0 and 1.0.
```javascript
{
"inputLayerName": "customLayerName",
"precision": 2,
"angle": 45,
"centered": "true",
"endPoint": "{
\"type\": \"Point\",
\"coordinates\": [6.014997043859679, 53.090253715796308]
}"
}
```
**Endpoint and startpoint are strings! not json!**

216
Create-b-cropfield.md Normal file
View File

@@ -0,0 +1,216 @@
## Creating a cropfield
This page explains what a cropfield is, and how to create one through the API.
Agricultural datasets generally refer to a specif crop, at a specific location at a specific time.
Therefore, we need to create a "Cropfield" item, to define this location and a timeframe our data relates to.
A cropfield provides a convienient way to group all data for a crop grown on a specific plot during a season.
Farmmaps also uses the cropfield to collect and prepare context data such as weather, satelite imagery etc.
To create a cropfield we:
* Get the parent folder to place the cropfield under
* Create the cropfield
**Prerequisites**
To create a cropfield we need:
* an acces token
* coordinates of the cropfield (what points define the plot contour)
* a startdate and an end date (what timeframe does this data aply to)
### Get parent element
First, we'll get the parent code needed to place the cropfield in the hierarchy.
Usually this is a cropping scheme.
So when the code of the crop field is known, use this code as parent code to create the crop field and go to the next chapter.
## Get cropping scheme
When the cropping scheme code is not known, we need to start from the top of the hierarchy, which is my_roots.
**Request**
Replace `<acces token>` with your actual token.
```http
GET https://farmmaps.eu/api/v1/folders/my_roots HTTP/1.1
Host: farmmaps.eu
Accept: application/json
Authorization: Bearer <access token>
```
**Response**
The response will be something similar to:
```http
HTTP/1.1 200 OK
Date: Fri, 27 Aug 2021 19:00:55 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Server: Kestrel
Cache-Control: no-store,no-cache
Pragma: no-cache
Content-Length: 835
```
In the list returned, search for item which ends with USER_IN, which is shown above.
This item will be the parent of the cropping scheme.
So make another call to check if a cropping scheme exist.
**Request**
Replace `<acces token>` with your actual token.
```http
GET https://farmmaps.eu/api/v1/items/f25d8765a1cd407cb235961c73c268cf:USER_IN/children HTTP/1.1
Host: farmmaps.eu
Accept: application/json
Authorization: Bearer <access token>
```
**Response**
The response will be something similar to:
```http
HTTP/1.1 200 OK
Date: Fri, 27 Aug 2021 19:17:36 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Server: Kestrel
Cache-Control: no-store,no-cache
Pragma: no-cache
Content-Length: 1519
```
When the list is empty, you need to create a new cropping scheme, which is described in another thread.
The `parentcode` we need for creating a crop field is **"f3ee8e3ac55b43bc89757bcaedc89992"**
### Create the cropfield
Now we can create the cropfield. We do so by setting `"itemType": "vnd.farmmaps.itemtype.cropfield"` and adding data to the geometry parameter.
Generally, a cropfield contour would be defined as a polygon, so we add `"type":"Polygon" and all the coordinates.
We also need to specify a `dataDate` and a `dataEndDate` to indicate the the timeframe of the growing season.
The `dataDate` needs to be before `dataEndDate` and cannot be on the same day.
**Request**
```http
POST /api/v1/items HTTP/1.1
Accept: application/json
Authorization: Bearer <acces token>
Content-Type: application/json
Cache-Control: no-cache
Host: farmmaps.awacc.nl
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 916
{
"parentCode": "f3ee8e3ac55b43bc89757bcaedc89992",
"itemType": "vnd.farmmaps.itemtype.cropfield",
"name": "cropfield test",
"dataDate": "2021-01-01T00:00:0.0Z",
"dataEndDate": "2021-12-31T00:00:00.0Z",
"data": {},
"geometry": {"type":"Polygon","coordinates":[[[6.09942873984307,53.070025028087],[6.09992507404607,53.0705617890585],[6.10036959220086,53.0710679529031],[6.10065149010421,53.0714062774307],[6.10087493644271,53.0716712354474],[6.10091082982487,53.0716936039203],[6.10165087441291,53.0712041549161],[6.10204994718318,53.0709349338005],[6.10263143118855,53.0705789370018],[6.10311578125011,53.0702657538294],[6.10331686552072,53.0701314102389],[6.103326530575,53.070119463569],[6.10309137950343,53.0699829669055],[6.10184241586523,53.0692902201371],[6.10168497998891,53.0691984306747],[6.10092987659869,53.0694894453514],[6.09942873984307,53.070025028087]]]}
}
```
**Response**
```http
HTTP/1.1 201 Created
Server: nginx/1.14.0 (Ubuntu)
Date: Fri, 27 Aug 2021 19:21:36 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Cache-Control: no-store,no-cache
Pragma: no-cache
Content-Encoding: br
Location: /api/v1/items/8ecbaa2d85d5484db7f16b281b7cd013
Vary: Accept-Encoding
{
"parentCode":"6601a06d812b40f9830c9fe4e63b1944",
"geometry": {
"type":"Polygon",
"coordinates":[[
[6.09942873984307,53.070025028087],
[6.09992507404607,53.0705617890585],
[6.10036959220086,53.0710679529031],
[6.10065149010421,53.0714062774307],
[6.10087493644271,53.0716712354474],
[6.10091082982487,53.0716936039203],
[6.10165087441291,53.0712041549161],
[6.10204994718318,53.0709349338005],
[6.10263143118855,53.0705789370018],
[6.10311578125011,53.0702657538294],
[6.10331686552072,53.0701314102389],
[6.103326530575,53.070119463569],
[6.10309137950343,53.0699829669055],
[6.10184241586523,53.0692902201371],
[6.10168497998891,53.0691984306747],
[6.10092987659869,53.0694894453514],
[6.09942873984307,53.070025028087]]
]},
"data":{},
"tags":[],
"isEditable":false,
"url":"/api/v1/items/8ecbaa2d85d5484db7f16b281b7cd013",
"code":"8ecbaa2d85d5484db7f16b281b7cd013",
"name":"cropfield for VRA",
"created":"2020-04-24T08:56:45.3727807Z",
"updated":"2020-04-24T08:56:45.3727807Z",
"dataDate":"2019-01-18T10:16:21.455Z",
"itemType":"vnd.farmmaps.itemtype.cropfield",
"size":0,
"state":0,
"thumbnail":false
}
```
**Troubleshooting**
|Status code|Description|
|---|---|
|201|Cropfield created successfully|
|401|Error: not authenticated|
|403|Error: No write permissions in parent item|
|404|Error: Parent item not found|
Now that the cropfield has been created, we can start the processing by running a task.
This will collext all context data for the cropfield.
We need the ItemCode of the cropfield to start the task so keep this at hand.
[6.10311578125011,53.0702657538294],
[6.10331686552072,53.0701314102389],
[6.103326530575,53.070119463569],
[6.10309137950343,53.0699829669055],
[6.10184241586523,53.0692902201371],
[6.10168497998891,53.0691984306747],
[6.10092987659869,53.0694894453514],
[6.09942873984307,53.070025028087]]
]},
"data":{},
"tags":[],
"isEditable":false,
"url":"/api/v1/items/8ecbaa2d85d5484db7f16b281b7cd013",
"code":"8ecbaa2d85d5484db7f16b281b7cd013",
"name":"cropfield for VRA",
"created":"2020-04-24T08:56:45.3727807Z",
"updated":"2020-04-24T08:56:45.3727807Z",
"dataDate":"2019-01-18T10:16:21.455Z",
"itemType":"vnd.farmmaps.itemtype.cropfield",
"size":0,
"state":0,
"thumbnail":false
}
```
**Troubleshooting**
|Status code|Description|
|---|---|
|201|Cropfield created successfully|
|401|Error: not authenticated|
|403|Error: No write permissions in parent item|
|404|Error: Parent item not found|
Now that the cropfield has been created, we can start the processing by running a task.
This will collext all context data for the cropfield.
We need the ItemCode of the cropfield to start the task so keep this at hand.

View File

@@ -1,55 +1,55 @@
## Polling task status
When a task is executed with the task API your retrieve a code.
This code can be used to poll the status of an item task execution.
The response 'message' field can contain a string message based on the context.
#### Get a list task of status for a given item
> Request
```javascript
GET /api/v1/items/{code}/tasks
```
> Response 200 OK
```javascript
[
{
"taskType": "string",
"code": "string",
"message": "string",
"state": "Error, Ok, Scheduled, Processing",
"started": "2020-03-20T11:13:20.568Z",
"finished": "2020-03-20T11:13:20.568Z"
},
{
"taskType": "string",
"code": "string",
"state": "Error, Ok, Scheduled, Processing",
}
]
```
Response 401 Not authenticated
Response 403 No READ permissions in parent item
Response 404 Parent Item not found
#### Get the status of a task for a given item and item task code
> Request
```javascript
GET /api/v1/items/{code}/tasks/{itemTaskCode}
```
> Response 200 OK
```javascript
{
"taskType": "string",
"code": "string",
"message": "string",
"state": "Error, Ok, Scheduled, Processing",
"started": "2020-03-20T11:13:20.568Z",
"finished": "2020-03-20T11:13:20.568Z"
}
```
Response 401 Not authenticated
Response 403 No READ permissions in parent item
## Polling task status
When a task is executed with the task API your retrieve a code.
This code can be used to poll the status of an item task execution.
The response 'message' field can contain a string message based on the context.
#### Get a list task of status for a given item
> Request
```javascript
GET /api/v1/items/{code}/tasks/
```
> Response 200 OK
```javascript
[
{
"taskType": "string",
"code": "string",
"message": "string",
"state": "0, 1, 2 or 3", // Error, Ok, Scheduled, Processing
"started": "2020-03-20T11:13:20.568Z",
"finished": "2020-03-20T11:13:20.568Z"
},
{
"taskType": "string",
"code": "string",
"state": "Error, Ok, Scheduled, Processing",
}
]
```
Response 401 Not authenticated
Response 403 No READ permissions in parent item
Response 404 Parent Item not found
#### Get the status of a task for a given item and item task code
> Request
```javascript
GET /api/v1/items/{code}/tasks/{itemTaskCode}
```
> Response 200 OK
```javascript
{
"taskType": "string",
"code": "string",
"message": "string",
"state": "0, 1, 2 or 3", // Error, Ok, Scheduled, Processing
"started": "2020-03-20T11:13:20.568Z",
"finished": "2020-03-20T11:13:20.568Z"
}
```
Response 401 Not authenticated
Response 403 No READ permissions in parent item
Response 404 Parent Item not found

View File

@@ -1,73 +1,77 @@
## Farmmaps Documentation Overview
### The documentation is still work in progress and heavily subject to change!
This page provides an index of the available documentation for the FarmMaps platform.
## Getting started
The main starting point for Farmmaps API access is the REST API.
To get started, follow the steps below.
The workflow and high-level architecture FarmMaps are documented on the [Farmmaps Workflow](Workflow.md) and [FarmMaps Main Components](Main-components.md) pages.
### Environments
At the moment, FarmMaps provides two environments for development.
* https://farmmaps.awtest.nl (testing environment, data is not persistent)
* https://farmmaps.awacc.nl (acceptation environment, data IS persistent)
When developing your application, using the **acceptation environment is highly recommended**.
### Obtaining credentials
To get access to the API, you need an akkerweb development account (akkerweb development and farmmaps development use the same credentials).
These can be created at:
* https://awacc.nl (for the acceptation environment)
* https://awtest.nl (for the testing environment)
Once you have an account, you can create a JSON Web Token to authenticate at the API endpoint.
### Authentication & Authorization flow
FarmMaps uses Open ID Connect to provide user authentication and authorization services.
Open ID Connect (and OAuth beneath the surface) allows your application to access user information or data that is located at another service, without providing you the password to access the account. This is very useful if your application relies on data that needs to provided by this other service for your application to work.
So, in the authentication flow there are two parties:
* The OpenID Provider (OP), holding the accounts database and providing the authentication services.
* The Relying Party (RP), relying on authentication through the OP, to get access to the required data or endpoints.
The general flow (for FarmMaps) is as follows:
* The user is at your application
* Your application needs to access the farmmaps account of that user (i.e. to upload, modify or retrieve data)
* Your application creates an authentication request for the Open ID Provider.
* The user is redirected to the "Log in page" of the OpenID Provider.
* The user logs in at the login page.
* On succesfull login, the user is redirected back to your application and the OpenID Provider returns an access token.
Now that the user is back at your applicaiton and the application has an access token, it can then request resources from the OpenID provider.
For each request, the access token needs to be sent along. This access token provides proof that the person sending the request is allowed to access the request and is who he/she claims to be. FarmMaps uses [JWT](https://jwt.io/introduction/) as the format for the access token.
To continue please see one of the articles below:
- [Integrating FarmMaps Open ID Connect into your application](Integrating-FarmMaps-OIDC.md)
- [Creating an access token for testing.](Create-access-token.md)
## Using the FarmMaps API
Once you have an access token, you can start querying the API.
A reference of the API can be found on [the swagger page](https://farmmaps.awacc.nl/swagger)
The API basics are uploading files, creating items and and running tasks to modify or convert data.
For testing purposes, [Postman](https://www.postman.com) can be used to perform HTTP requests more easily.
We provide the following guides:
* [Uploading a file](Upload-a-file.md)
* [Creating a cropfield](Create-a-cropfield.md)
* [Running a task](Running-tasks.md)
Generally, tasks can be run in the same way.
However, each specific task has it's own inputs and properties.
How these work can be found in the use task examples below.
### <a name="task-examples"></a>Task examples
* [VRAPoten-API](VRAPoten-API.md)
* [VRANbs-API](VRANbs-API.md)
* [VRAHerbicide-API](VRAHerbicide-API.md)
## Farmmaps Documentation Overview
### The documentation is still work in progress and heavily subject to change!
This page provides an index of the available documentation for the FarmMaps platform.
## Getting started
The main starting point for Farmmaps API access is the REST API.
To get started, follow the steps below.
The workflow and high-level architecture FarmMaps are documented on the [Farmmaps Workflow](Workflow.md) and [FarmMaps Main Components](Main-components.md) pages.
### Environments
At the moment, FarmMaps provides two environments for development.
* https://test.farmmaps.eu (testing environment, data is not persistent)
* https://acc.farmmaps.eu (acceptation environment, data IS persistent)
When developing your application, using the **acceptation environment is highly recommended**.
### Obtaining credentials
To get access to the API, you need an akkerweb development account (akkerweb development and farmmaps development use the same credentials).
These can be created at:
* https://test.farmmaps.eu (for the acceptation environment)
* https://test.farmmaps.eu(for the testing environment)
It is also possible to get credentials to use the cleint credential flow, please contact FarmMaps for further information.
Once you have an account, you can create a JSON Web Token to authenticate at the API endpoint.
### Authentication & Authorization flow
FarmMaps uses Open ID Connect to provide user authentication and authorization services.
Open ID Connect (and OAuth beneath the surface) allows your application to access user information or data that is located at another service, without providing you the password to access the account. This is very useful if your application relies on data that needs to provided by this other service for your application to work.
So, in the authentication flow there are two parties:
* The OpenID Provider (OP), holding the accounts database and providing the authentication services.
* The Relying Party (RP), relying on authentication through the OP, to get access to the required data or endpoints.
The general flow (for FarmMaps) is as follows:
* The user is at your application
* Your application needs to access the farmmaps account of that user (i.e. to upload, modify or retrieve data)
* Your application creates an authentication request for the Open ID Provider.
* The user is redirected to the "Log in page" of the OpenID Provider.
* The user logs in at the login page.
* On succesfull login, the user is redirected back to your application and the OpenID Provider returns an access token.
Now that the user is back at your application and the application has an access token, it can then request resources from the OpenID provider.
For each request, the access token needs to be sent along. This access token provides proof that the person sending the request is allowed to access the request and is who he/she claims to be. FarmMaps uses [JWT](https://jwt.io/introduction/) as the format for the access token.
To continue please see one of the articles below:
- [Integrating FarmMaps Open ID Connect into your application](Integrating-FarmMaps-OIDC.md)
- [Creating an access token for testing.](Create-access-token.md)
## Using the FarmMaps API
Once you have an access token, you can start querying the API.
A reference of the API can be found on [the swagger page](https://acc.farmmaps.eu/swagger/)
The API basics are uploading files, creating items and and running tasks to modify or convert data.
For testing purposes, [Postman](https://www.postman.com) can be used to perform HTTP requests more easily.
We provide the following guides:
* [Uploading a file](Upload-a-file.md)
* [Creating a cropfield](Create-a-cropfield.md)
* [Running a task](Running-tasks.md)
Generally, tasks can be run in the same way.
However, each specific task has it's own inputs and properties.
How these work can be found in the use task examples below.
### <a name="task-examples"></a>Task examples
* [VRAPoten-API](VRAPoten-API.md)
* [VRANbs-API](VRANbs-API.md)
* [VRAHerbicide-API](VRAHerbicide-API.md)
* [VRAHaulmkilling-API](VRAHaulmkilling-API.md)
* [Blight-API](Blight-API.md)

48
Shape-to-geotiff.md Normal file
View File

@@ -0,0 +1,48 @@
## Transform a shape file to a tiff file
If your input data is a processed shape file it first needs to be converted to geotiff, this can be done with the 'ShapeToGeoTiffTask'.
Pass the code of the shape item into the {code} parameter, this creates a new item with tiff data as a sibling of the shape item with the same parent
This new geotiff item should be used as input to the a task.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayers**
* array of of input layer name strings
* Default is processing all layers
* **algorithm**
* Valid inputs can be found here https://gdal.org/programs/gdal_grid.html#interpolation-algorithms
* Example of the default **"invdistnn:radius=100:min_points=2"**
* **resolution**
* The resolution in meters for the final tiff file. [1, 100]
* Default is 1
defaults are false
```javascript
{
"inputLayers": "[\"height\", \"lutum\"]", // the value is a string not a json array!
"algorithm": "invdistnn:radius=100:min_points=2",
"resolution": 5
}
```

154
VRAHaulmkilling-API.md Normal file
View File

@@ -0,0 +1,154 @@
## VRAHaulmkilling API
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API expects that all data is already processed and available provided, for example through the normal FarmMaps flow (frontend).
For the currently available public FarmMaps API you can take a look at swagger: https://test.farmmaps.eu/swagger
**Input preperation**
* Users can upload their own data if needed. (in case of when FarmMaps has not processed the required data).
* The farmmaps file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
**Users can query the API for child items of a cropfield to see what items it has.**
### API flow
* Authenticate User
* Optional steps
* *Create cropfield through FarmMaps API*
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' can be executed if needed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* *Upload own data*
* IF shape data, convert to geotiff.
* Querying predefined haulmkilling agents (to use as input for the task).
* Task 'vnd.farmmaps.task.vrahaulmkilling' must be executed to create an application map.
* Task 'vnd.farmmaps.task.taskmap' can be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
[Authentication](Authentication.md)
##### Optional
[Create Cropfield](Create-Cropfield.md)
[Upload Data](Upload-Data.md)
###### Transform shape to geotiff
[Shape to geotiff](Shape-to-geotiff.md)
###### Querying predefined haulmkilling agents.
A list of haulmkilling agents can be requested by getting the "vnd.farmmaps.itemtype.codelist.fm005" items from farmmaps.
> Request
```javascript
GET /api/v1/items/?it=vnd.farmmaps.itemtype.codelist.fm005
```
> Response 201
```javascript
[
{
"code": "....",
// ....
"data":
{
"cl": "vnd.farmmaps.itemtype.codelist.ctgb",
"code": "9326",
"label": "quickdown",
"options": "risk.standard,risk.high"
}
},
...
]
```
Response 400 Itemtype not found
Response 401 Not authenticated
Response 403 No READ permissions in item
Response 404 Items not found
An item's data property contains a single haulmkilling agent with its crop protection agent code in farmmaps.
To get additional information for a crop protection agent you can query farmmaps for the "vnd.farmmaps.itemtype.codelist.ctgb" itemtype and with a datafilter with the code specified in the haulmkilling agent item's data property as above.
###### Creating an application map with the VRAHaulmkilling task
Execute the task with the item code of the cropfield as parameter inside {code}.
Use the code of the input item inside {itemCode}, this specifies an item to use as input.
The resulting application map will be created as a child item of the cropfield item (this item can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vrahaulmkilling",
"attributes": {
"inputCode": "{itemCode}",
"inputType": "wdvi", // wdvi or ndvi only
"agentName": "quickdown", // !deprecated!
"agentCode": "9326" // This is not an item code!!!
"selectedOption": "risk.standard"
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vrahaulmkilling",
"attributes": {
"inputCode": "{itemCode}",
"inputType": "wdvi", // wdvi or ndvi only
"agentName": "quickdown", // !deprecated!
"agentCode": "9326" // This is not an item code!!!
"selectedOption": "risk.standard"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
**'inputCode'**
**'agentCode'** needs to have a value that is gotten from the haulmkilling agent query. This is not an item code!!!
**'inputType'** "wdvi" or "ndvi"
**'selectedOption'** needs to have a value that is gotten from the haulmkilling agent query.
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayerName**
Allows you to specify which layer to use for an input item.
* **minPercentile** value between 0.0 - 1.0
Allows you to specify the minimum percentile value to 'filter' lower bound input data
* **maxPercentile** value between 0.0 - 1.0
Allows you to specify the maximum percentile value to 'filter' upperbound bound input data
* **plantingDate** if relevant
Allows you to specify the date the crop is planted.
* **measurementDate** if relevant
allows you to specify the date when the measurements were taken.
Default input layer name for Haulmkilling is the agent inputType used (wdvi, ndvi).
Default percentile values for Haulmkilling are 0.05 and 0.90.
Default dates are 'inherited' from the cropfield item passed to the task.
```javascript
{
"inputLayerName": "customLayerName",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"minPercentile": "0.1",
"maxPercentile": "0.95"
}
```
##### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the items API.
> Request
```javascript
GET /api/v1/items/{itemcode}/download

View File

@@ -1,172 +1,149 @@
## VRAHerbicide API
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API expects that all data is already processed and available provided, for example through the normal FarmMaps flow (frontend).
For the currently available public FarmMaps API you can take a look at swagger: http://farmmaps.awtest.nl/swagger/index.html
**Input preperation**
* Users can upload their own data if needed. (in case of when FarmMaps has not processed the required data).
* The farmmaps file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
**Users can query the API for child items of a cropfield to see what items it has.**
### API flow
* Authenticate User
* Optional steps
* *Create cropfield through FarmMaps API*
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' needs to be executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* *Upload own data*
* IF shape data, convert to geotiff.
* Task 'vnd.farmmaps.task.vraherbicide' must be executed to create an application map.
* Task 'vnd.farmmaps.task.taskmap' can be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
[Authentication](Authentication.md)
##### Optional
[Create Cropfield](Create-Cropfield.md)
[Upload Data](Upload-Data.md)
###### Transform shape to geotiff
The VRAHerbicide task only processes tiff items as input.
If your input data is a processed shape file it first needs to be converted to geotiff, this can be done with the 'ShapeToGeoTiffTask'.
Pass the code of the shape item into the {code} parameter, this creates a new item with tiff data as the parent of the shape item.
This new geotiff item should be used as input to the a task.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
###### Querying predefined herbicide agents.
A list of herbicide agents can be requested by finding the "vnd.farmmaps.package.vra.herbicide" items, taking the first item found and reading it's data field 'agents' array content.
> Request
```javascript
GET /api/v1/items/?it=vnd.farmmaps.package.vra.herbicide
```
> Response 201
```javascript
{
"code": "....",
"data": {
"agents": [
{
"name": "Liberator",
"SoilType": "Dalgrond",
"ExtraInputType": "Lutum",
"MinDosis": 2,
"MaxDosis": 3,
"A": 0.1428,
"B": 1.285714,
"C": 1,
"D": 97,
"E": 3,
"P": 1,
"Crop": "Zetmeelaardappelen"
}
]
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No READ permissions in item
Response 404 Items not found
###### Creating an application map with the VRAHerbicide task
Execute the task with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it.
An **optional** {extraItemCode} can be passed inside the 'extraInputcode' field to process herbicide from 2 inputs.
Fill in the agent field with an agent gotten from the herbicide agents query discussed above.
The resulting application map will be created as a child item of the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vraherbicide",
"attributes": {
"inputCode": "{itemCode}",
"extraInputCode": "{extraItemCode}",
"agent": {
"SoilType": "Dalgrond",
"ExtraInputType": "Lutum",
"MinDosis": 2,
"MaxDosis": 3,
"A": 0.1428,
"B": 1.285714,
"C": 1,
"D": 97,
"E": 3,
"P": 1,
"Crop": "Zetmeelaardappelen"
}
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vraherbicide",
"attributes": {
"inputCode": "{itemCode}",
"extraInputCode": "{extraItemCode}",
"agent": {
"SoilType": "Dalgrond",
"ExtraInputType": "Lutum",
"MinDosis": 2,
"MaxDosis": 3,
"A": 0.1428,
"B": 1.285714,
"C": 1,
"D": 97,
"E": 3,
"P": 1,
"Crop": "Zetmeelaardappelen"
}
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the File API.
> Request
```javascript
GET /api/v1/items/{itemcode}/data
## VRAHerbicide API
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API expects that all data is already processed and available provided, for example through the normal FarmMaps flow (frontend).
For the currently available public FarmMaps API you can take a look at swagger: https://test.farmmaps.eu/swagger
**Input preperation**
* Users can upload their own data if needed. (in case of when FarmMaps has not processed the required data).
* The farmmaps file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
**Users can query the API for child items of a cropfield to see what items it has.**
### API flow
* Authenticate User
* Optional steps
* *Create cropfield through FarmMaps API*
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' can be executed if needed executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* *Upload own data*
* IF shape data, convert to geotiff.
* Querying predefined herbicide agents
* Task 'vnd.farmmaps.task.vraherbicide' must be executed to create an application map.
* Task 'vnd.farmmaps.task.taskmap' can be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
[Authentication](Authentication.md)
##### Optional
[Create Cropfield](Create-Cropfield.md)
[Upload Data](Upload-Data.md)
###### Transform shape to geotiff
[Shape to geotiff](Shape-to-geotiff.md)
###### Querying predefined herbicide agents.
A list of herbicide agents can be requested by getting the "vnd.farmmaps.itemtype.codelist.fm006" items from farmmaps.
> Request
```javascript
GET /api/v1/items/?it=vnd.farmmaps.itemtype.codelist.fm006
```
> Response 201
```javascript
[
{
"code": "....",
// ....
"data":
{
"code": "0001",
"crop": "zetmeelaardappelen",
"name": "arcade_challenge_olie",
...
}
},
...
]
```
Response 400 Itemtype not found
Response 401 Not authenticated
Response 403 No READ permissions in item
Response 404 Items not found
###### Creating an application map with the VRAHerbicide task
Execute the task with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it.
An **optional** {extraItemCode} can be passed inside the 'extraInputcode' field to process herbicide from 2 inputs.
Fill in the agent field with an agent gotten from the herbicide agents query discussed above.
The resulting application map will be created as a child item of the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vraherbicide",
"attributes": {
"inputCode": "{itemCode}",
"extraInputCode": "{extraItemCode}",
"agentCode": "0001"
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vraherbicide",
"attributes": {
"inputCode": "{itemCode}",
"extraInputCode": "{extraItemCode}",
"agentCode": "0001"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayerName**
Allows you to specify which layer to use for an input item.
* **extraInputLayerName**
Allows you to specify which layer to use for the extra input item.
* **minPercentile** value between 0.0 - 1.0
Allows you to specify the minimum percentile value to 'filter' lower bound input data
* **maxPercentile** value between 0.0 - 1.0
Allows you to specify the maximum percentile value to 'filter' upperbound bound input data
* **plantingDate** if relevant
Allows you to specify the date the crop is planted.
* **measurementDate** if relevant
allows you to specify the date when the measurements were taken.
Default input layer name for herbicide is the agent inputType used (lutum, om).
Default percentile values for herbicide are 0.0 and 1.0.
Default dates are 'inherited' from the cropfield item passed to the task.
```javascript
{
"inputLayerName": "customLayerName",
"extraInputLayerName": "customLayerName",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"minPercentile": "0.1",
"maxPercentile": "0.95"
}
```
##### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the items API.
> Request
```javascript
GET /api/v1/items/{itemcode}/download

View File

@@ -1,295 +1,291 @@
## VRANbs API v0.2
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API expects that all data is already processed and available provided, for example through the normal FarmMaps flow (frontend).
For the currently available public FarmMaps API you can take a look at swagger: http://farmmaps.awtest.nl/swagger/index.html
**Limitations**
* Currently VRANbs only accepts input tiffs in WGS84/EPSG4326
* Data isn't automatically deleted as farmmaps has no support for this.
* But API users can delete their own items through the farmmaps API.
**Input preperation**
* Users can upload their own data if needed. (in case of when FarmMaps has not processed the required data).
* The farmmaps file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
**Users can query the API for child items of a cropfield to see what items it has.**
### API flow
* Authenticate User
* Optional steps
* *Create cropfield through FarmMaps API*
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' needs to be executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* *Upload own data*
* IF shape data, convert to geotiff.
* *Create 'vnd.farmmaps.itemtype.user.input' item for targetn calculation.*
* *Task 'vnd.farmmaps.task.vranbs' can be executed with the 'targetn' operation*
* *Task 'vnd.farmmaps.task.vranbs' can be executed with 'uptake' operation* to create an nitrogen uptake map.
* Task 'vnd.farmmaps.task.vranbs' must be executed with 'nitrogen' operation to create an appliance map.
* Task 'vnd.farmmaps.task.taskmap' can be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
[Authentication](Authentication.md)
##### Optional
[Create Cropfield](Create-Cropfield.md)
[Upload Data](Upload-Data.md)
###### Transform shape to geotiff
The VRANbs task only processes tiff items as input.
If your input data is a processed shape file it first needs to be converted to geotiff, this can be done with the 'ShapeToGeoTiffTask'.
Pass the code of the shape item into the {code} parameter, this creates a new item with tiff data as the parent of the shape item.
This new geotiff item should be used as input to the vranbs task.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.shapetogeotiff"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Using VRA Nitrogen fertilization task
The VraNbs task currently supports 3 operations:
* **targetn** - calculates the target nitrogen based on target yield.
* **uptake** - creates the nitrogen uptake map.
* **application** - creates the nitrogen fertilization application map.
###### targetn operation
Create a 'vnd.farmmaps.itemtype.user.input' item to use in this operation.
(step not needed if you already know the target nitrogen you want to work with.)
The user.input item must parent the '{user_code}:USER_IN' item and can be obtained by calling following request:
> Request
```javascript
GET /api/v1/Folders/my_uploads
```
> Response 201
```javascript
{
"url": "/api/v1/folders/{user_code}:USER_IN",
"code": "{user_code}:USER_IN",
"name": "Uploaded",
"created": "2020-03-04T14:41:41.099557",
"updated": "2020-03-04T14:41:41.099557",
"itemType": "FOLDER",
"size": 0,
"state": 0,
"thumbnail": false
}
```
**Create item**
Create user.input item, pass just obtained parent code as parameter in {user_code}.
> Request
```javascript
POST /api/v1/items
{
"parentCode": "{user_code}:USER_IN",
"itemType": "vnd.farmmaps.itemtype.user.input",
"name": "TargetN",
"dataDate": "2020-03-02T14:22:09.265Z"
}
```
> Response 201 Created
```javascript
{
"parentCode": "string",
"geometry": {},
"data": {},
"tags": [
"string"
],
"url": "string",
"code": "string",
"name": "string",
"created": "2019-12-18T10:16:21.455Z",
"updated": "2019-12-18T10:16:21.455Z",
"dataDate": "2019-12-18T10:16:21.455Z",
"itemType": "string",
"sourceTask": "string",
"size": 0,
"state": 0,
"thumbnail": true
}
```
Response 401 Not authenticated
Response 403 No WRITE permissions in parent item
Response 404 Parent Item not found
**Call the vranbs task**
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the code obtained from creating the user.input item as a parameter in {itemCode}.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "targetn",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"purposeType": "consumption", // consumption, fries, potato, starch
"targetYield": "60"
}
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.workflow"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
**Query user.input targetN item**
You can query the user.input item to get the calculated targetN value from the data field of the item.
> Request
```javascript
GET /api/v1/items/{code}
```
> Response 200
```javascript
{
"parentCode": "string",
"geometry": {},
"data": {
"TSum": "2700",
"TargetYield": "60",
"TargetN": "249.2341"
},
"tags": [
"string"
],
"url": "string",
"code": "string",
"name": "TargetN",
"created": "2019-12-18T10:16:21.455Z",
"updated": "2019-12-18T10:16:21.455Z",
"dataDate": "2019-12-18T10:16:21.455Z",
"itemType": "vnd.farmmaps.itemtype.user.input",
"sourceTask": "string",
"size": 0,
"state": 0,
"thumbnail": true
}
```
###### Uptake map operation
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it. ex. uploaded isaria/data data.
The resulting nitrogen uptake map will be created as a child item under the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "uptake",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"inputType": "irmi", // yara, ci, irmi or wdvi
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "uptake",
"inputCode": "{itemCode}",
"inputType": "irmi", // yara, ci, irmi or wdvi
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
###### Application map operation
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it. ex. uploaded isaria/data data.
The resulting nitrogen application map will be created as a child item under the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "application",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"inputType": "irmi", // yara, ci, irmi or wdvi
"targetN": "249.22948"
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "nitrogen",
"inputCode": "{itemCode}",
"inputType": "irmi", // yara, ci, irmi or wdvi
"targetN": "249.22948"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the File API.
> Request
```javascript
GET /api/v1/items/{itemcode}/data
## VRANbs API v0.3
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API expects that all data is already processed and available provided, for example through the normal FarmMaps flow (frontend).
For the currently available public FarmMaps API you can take a look at swagger: https://test.farmmaps.eu/swagger
**Limitations**
* Currently VRANbs only accepts input tiffs in WGS84/EPSG4326
* Data isn't automatically deleted as farmmaps has no support for this.
* But API users can delete their own items through the farmmaps API.
**Input preperation**
* Users can upload their own data if needed. (in case of when FarmMaps has not processed the required data).
* The farmmaps file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
**Users can query the API for child items of a cropfield to see what items it has.**
### API flow
* Authenticate User
* Optional steps
* *Create cropfield through FarmMaps API*
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' needs to be executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* *Upload own data*
* IF shape data, convert to geotiff.
* *Create 'vnd.farmmaps.itemtype.user.input' item for targetn calculation.*
* *Task 'vnd.farmmaps.task.vranbs' can be executed with the 'targetn' operation*
* *Task 'vnd.farmmaps.task.vranbs' can be executed with 'uptake' operation* to create an nitrogen uptake map.
* Task 'vnd.farmmaps.task.vranbs' must be executed with 'nitrogen' operation to create an appliance map.
* Task 'vnd.farmmaps.task.taskmap' can be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
[Authentication](Authentication.md)
##### Optional
[Create Cropfield](Create-Cropfield.md)
[Upload Data](Upload-Data.md)
###### Transform shape to geotiff
[Shape to geotiff](Shape-to-geotiff.md)
##### Using VRA Nitrogen fertilization task
The VraNbs task currently supports 3 operations:
* **targetn** - calculates the target nitrogen based on target yield.
* **uptake** - creates the nitrogen uptake map.
* **application** - creates the nitrogen fertilization application map.
###### targetn operation
Create a 'vnd.farmmaps.itemtype.user.input' item to use in this operation.
(step not needed if you already know the target nitrogen you want to work with.)
The user.input item must parent the '{user_code}:USER_IN' item and can be obtained by calling following request:
> Request
```javascript
GET /api/v1/Folders/my_uploads
```
> Response 201
```javascript
{
"url": "/api/v1/folders/{user_code}:USER_IN",
"code": "{user_code}:USER_IN",
"name": "Uploaded",
"created": "2020-03-04T14:41:41.099557",
"updated": "2020-03-04T14:41:41.099557",
"itemType": "FOLDER",
"size": 0,
"state": 0,
"thumbnail": false
}
```
**Create item**
Create user.input item, pass just obtained parent code as parameter in {user_code}.
> Request
```javascript
POST /api/v1/items
{
"parentCode": "{user_code}:USER_IN",
"itemType": "vnd.farmmaps.itemtype.user.input",
"name": "TargetN",
"dataDate": "2020-03-02T14:22:09.265Z"
}
```
> Response 201 Created
```javascript
{
"parentCode": "string",
"geometry": {},
"data": {},
"tags": [
"string"
],
"url": "string",
"code": "string",
"name": "string",
"created": "2019-12-18T10:16:21.455Z",
"updated": "2019-12-18T10:16:21.455Z",
"dataDate": "2019-12-18T10:16:21.455Z",
"itemType": "string",
"sourceTask": "string",
"size": 0,
"state": 0,
"thumbnail": true
}
```
Response 401 Not authenticated
Response 403 No WRITE permissions in parent item
Response 404 Parent Item not found
**Call the vranbs task**
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the code obtained from creating the user.input item as a parameter in {itemCode}.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "targetn",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"purposeType": "consumption", // consumption, fries, potato, starch
"targetYield": "60"
}
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.workflow"
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
**Query user.input targetN item**
You can query the user.input item to get the calculated targetN value from the data field of the item.
> Request
```javascript
GET /api/v1/items/{code}
```
> Response 200
```javascript
{
"parentCode": "string",
"geometry": {},
"data": {
"TSum": "2700",
"TargetYield": "60",
"TargetN": "249.2341"
},
"tags": [
"string"
],
"url": "string",
"code": "string",
"name": "TargetN",
"created": "2019-12-18T10:16:21.455Z",
"updated": "2019-12-18T10:16:21.455Z",
"dataDate": "2019-12-18T10:16:21.455Z",
"itemType": "vnd.farmmaps.itemtype.user.input",
"sourceTask": "string",
"size": 0,
"state": 0,
"thumbnail": true
}
```
###### Uptake map operation
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it. ex. uploaded isaria/data data.
The resulting nitrogen uptake map will be created as a child item under the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "uptake",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"inputType": "irmi", // yara, ci, irmi or wdvi
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "uptake",
"inputCode": "{itemCode}",
"inputType": "irmi", // yara, ci, irmi or wdvi
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
###### Application map operation
Execute the VRANbsTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode for the input data item.
{itemCode} needs the code of the data input item passed into it. ex. uploaded isaria/data data.
The resulting nitrogen application map will be created as a child item under the cropfield item (this can be queried).
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "application",
"inputCode": "{itemCode}",
"plantingDate": "2020-02-01T00:00:00.000Z",
"measurementDate": "2020-06-01T00:00:00.000Z",
"inputType": "irmi", // yara, ci, irmi or wdvi
"targetN": "249.22948"
}
}
```
> Response 201
```javascript
{
"code": "string", // code of task operation, can be queried for status
"taskType": "vnd.farmmaps.task.vranbs",
"attributes": {
"operation": "nitrogen",
"inputCode": "{itemCode}",
"inputType": "irmi", // yara, ci, irmi or wdvi
"targetN": "249.22948"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayerName**
Allows you to specify which layer to use for an input item.
* **minPercentile** value between 0.0 - 1.0
Allows you to specify the minimum percentile value to 'filter' lower bound input data
* **maxPercentile** value between 0.0 - 1.0
Allows you to specify the maximum percentile value to 'filter' upperbound bound input data
Default percentile values for nbs are 0.0 and 1.0.
```javascript
{
"inputLayerName": "customLayerName",
"minPercentile": "0.1",
"maxPercentile": "0.95"
}
```
##### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the items API.
> Request
```javascript
GET /api/v1/items/{itemcode}/download

View File

@@ -1,85 +1,105 @@
## VRAPoten API v0.1.1
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API 2 that all data is already processed and available provided, for example through the normal FarmMaps flow.
For the currently available public FarmMaps API you can take a look at swagger: http://farmmaps.awtest.nl/swagger/index.html
**Input preperation**
* VRAPoten requires specific input which needs to be provided by the FarmMaps API or user interface.
* You can activate the VRAPotenTask with the Task API, passing the just created cropfield item code as a parameter.
* Users can upload their own soilmaps if needed. (in case of when FarmMaps has not processed the required data).
* The file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
### API flow
* Authenticate User
* *Create cropfield through FarmMaps API (optioneel)*
* Item 'FOLDER' must be created for parent to cropfields.
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' needs to be executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* Upload own soil data (optioneel)
* Task 'vnd.farmmaps.task.vrapoten' must be executed to create an appliance map.
* Task 'vnd.farmmaps.task.taskmap' must be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
###### Authentication
[Authentication](Authentication.md)
###### Create cropfield with FarmMaps API (optional)
[Create Cropfield](Create-Cropfield.md)
###### Uploading own data (optional)
[Upload Data](Upload-Data.md)
###### Creating appliance maps
Execute the VRAPotenTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode is optional.
In case of no specified inputCode the BOFEK data is looked up and if it could not be found the task gives an error.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vrapoten",
"attributes": {
"inputCode": "{itemCode}",
"meanDensity": "30",
"variation": "20"
}
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.workflow",
"delay": "",
"attributes": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
###### Create taskmap
[Create Taskmap](Create-Taskmap.md)
###### Download the data
In case the data is available it can be downloaded with the File API.
> Request
```javascript
GET /api/v1/items/{itemcode}/data
```
## VRAPoten API v0.1.1
[<< Home](README.md)
FarmMaps is an asynchronous architecture, the API flow keeps this in mind.
The API 2 that all data is already processed and available provided, for example through the normal FarmMaps flow.
For the currently available public FarmMaps API you can take a look at swagger: https://test.farmmaps.eu/swagger
**Input preperation**
* VRAPoten requires specific input which needs to be provided by the FarmMaps API or user interface.
* You can activate the VRAPotenTask with the Task API, passing the just created cropfield item code as a parameter.
* Users can upload their own soilmaps if needed. (in case of when FarmMaps has not processed the required data).
* The file API can be used for this.
**Users can poll the task api to see if a task is completed**
**This can be achieved with the task execution id obtained from calling the 'ItemTask' API.**
[Poll task status](Polling-task-status.md)
### API flow
* Authenticate User
* *Create cropfield through FarmMaps API (optioneel)*
* Item 'FOLDER' must be created for parent to cropfields.
* Item 'vnd.farmmaps.itemtype.cropfield' must be created with its data as specified in the api.
* Task 'vnd.farmmaps.task.workflow' needs to be executed to aggregate all needed data.
* This is an asynchronous process and can take a while before all data is collected in FarmMaps.
* Upload own soil data (optioneel)
* Task 'vnd.farmmaps.task.vrapoten' must be executed to create an appliance map.
* Task 'vnd.farmmaps.task.taskmap' must be executed to create a taskmap.
* Download item data (tiff of shape)
### Steps
###### Authentication
[Authentication](Authentication.md)
###### Create cropfield with FarmMaps API (optional)
[Create Cropfield](Create-Cropfield.md)
###### Uploading own data (optional)
[Upload Data](Upload-Data.md)
###### Creating appliance maps
Execute the VRAPotenTask with the item code of the cropfield as parameter inside {code}.
Use the input map code inside {itemCode}, specifying an inputCode is optional.
In case of no specified inputCode the BOFEK data is looked up and if it could not be found the task gives an error.
> Request
```javascript
POST /api/v1/items/{code}/tasks
{
"taskType": "vnd.farmmaps.task.vrapoten",
"attributes": {
"inputCode": "{itemCode}",
"meanDensity": "30",
"variation": "20"
}
}
```
> Response 201
```javascript
{
"code": "string",
"taskType": "vnd.farmmaps.task.workflow",
"delay": "",
"attributes": {
"additionalProp1": "string",
"additionalProp2": "string",
"additionalProp3": "string"
}
}
```
Response 400 Tasktype not found
Response 401 Not authenticated
Response 403 No WRITE permissions in item
Response 404 Item not found
##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility.
* **inputLayerName**
* Allows you to specify which layer to use for an input item.
* **countPerArea**
* Allows you to specify if spacing in cm needs to be calculated to count per area in m2.
* **useShadow**
* Use shadow map in the calculation if available.
defaults are false
```javascript
{
"inputLayerName": "EC_30",
"countPerArea": true,
"useShadow": true
}
```
###### Create taskmap
[Create Taskmap](Create-Taskmap.md)
##### Download the data
In case the data is available it can be downloaded with the items API.
> Request
```javascript
GET /api/v1/items/{itemcode}/download