Update 'VRAHaulmkilling-API.md'

This commit is contained in:
Mark van der Wal 2021-04-11 14:44:13 +00:00
parent 5168f79d5b
commit 9cebe41857

View File

@ -65,10 +65,10 @@ Response 403 No WRITE permissions in item
Response 404 Item not found Response 404 Item not found
###### Querying predefined haulmkilling agents. ###### Querying predefined haulmkilling agents.
A list of haulmkilling agents can be requested by getting the "vnd.farmmaps.package.vra.haulmkilling" item and reading it's data field 'agents' array content. A list of haulmkilling agents can be requested by getting the "vnd.farmmaps.itemtype.codelist.fm005" items from farmmaps.
> Request > Request
```javascript ```javascript
GET /api/v1/items/?it=vnd.farmmaps.package.vra.haulmkilling GET /api/v1/items/?it=vnd.farmmaps.itemtype.codelist.fm005
``` ```
> Response 201 > Response 201
```javascript ```javascript
@ -77,72 +77,10 @@ GET /api/v1/items/?it=vnd.farmmaps.package.vra.haulmkilling
// .... // ....
"data": "data":
{ {
"agents": [ "cl": "vnd.farmmaps.itemtype.codelist.ctgb",
{ "code": "9326",
"name": "spotlightplus", "label": "quickdown",
"values": { "options": "risk.standard,risk.high"
"ndvi": [
{
"max": 0.95,
"min": 0.3,
"fexp": 1.35,
"fmul": 0.3,
"option": "risk.standard"
},
{
"max": 0.9,
"min": 0.25,
"fexp": 1.39,
"fmul": 0.25,
"option": "risk.low"
},
{
"max": 1,
"min": 0.35,
"fexp": 1.3,
"fmul": 0.36,
"option": "risk.high"
}
],
"wdvi": [
{
"max": 0.95,
"min": 0.3,
"fexp": 2.97,
"fmul": 0.3,
"option": "risk.standard"
},
{
"max": 0.9,
"min": 0.25,
"fexp": 2.97,
"fmul": 0.25,
"option": "risk.low"
},
{
"max": 1,
"min": 0.35,
"fexp": 2.97,
"fmul": 0.36,
"option": "risk.high"
}
]
},
"supportedOptions": [
"risk.standard",
"risk.low",
"risk.high"
]
}
],
"validOptions": [
"risk.standard",
"risk.low",
"risk.high",
"weed",
"split.first",
"split.second"
]
} }
} }
``` ```
@ -152,34 +90,8 @@ Response 401 Not authenticated
Response 403 No READ permissions in item Response 403 No READ permissions in item
Response 404 Items not found Response 404 Items not found
The data structure contains the haulmkilling **agents** and the **valid options** available in farmmaps. An item's data property contains a single haulmkilling agent with its crop protection agent code in farmmaps.
Each agent contains a list of supported options and a key value map of a list of constants. 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.
The key is a supported inputtype (wdvi, ndvi) and the value is a list of constant objects like so:
```javascript
{
"name": "agentName",
"values": {
"ndvi": [
{
"max": 0.9,
"min": 0.25,
"fexp": 2.97,
"fmul": 0.25,
"option": "risk.low"
},
{
"max": 0.95,
"min": 0.3,
"fexp": 1.35,
"fmul": 0.3,
"option": "risk.standard"
}
],
"wdvi": [{...}]
}
}
```
Each constant value object has an **'option'** associated with it that should also be within the **'validOptions'** list of the data structure.
###### Creating an application map with the VRAHaulmkilling task ###### Creating an application map with the VRAHaulmkilling task
Execute the task with the item code of the cropfield as parameter inside {code}. Execute the task with the item code of the cropfield as parameter inside {code}.
@ -193,8 +105,9 @@ POST /api/v1/items/{code}/tasks
"taskType": "vnd.farmmaps.task.vrahaulmkilling", "taskType": "vnd.farmmaps.task.vrahaulmkilling",
"attributes": { "attributes": {
"inputCode": "{itemCode}", "inputCode": "{itemCode}",
"inputType": "wdvi", "inputType": "wdvi", // wdvi or ndvi only
"agentName": "reglone", "agentName": "quickdown", // !deprecated!
"agentCode": "9326" // This is not an item code!!!
"selectedOption": "risk.standard" "selectedOption": "risk.standard"
} }
} }
@ -206,8 +119,9 @@ POST /api/v1/items/{code}/tasks
"taskType": "vnd.farmmaps.task.vrahaulmkilling", "taskType": "vnd.farmmaps.task.vrahaulmkilling",
"attributes": { "attributes": {
"inputCode": "{itemCode}", "inputCode": "{itemCode}",
"inputType": "wdvi", "inputType": "wdvi", // wdvi or ndvi only
"agentName": "reglone", "agentName": "quickdown", // !deprecated!
"agentCode": "9326" // This is not an item code!!!
"selectedOption": "risk.standard" "selectedOption": "risk.standard"
} }
} }
@ -218,30 +132,11 @@ Response 401 Not authenticated
Response 403 No WRITE permissions in item Response 403 No WRITE permissions in item
Response 404 Item not found Response 404 Item not found
**'inputCode'** needs to have a value that is gotten from the haulmkilling agent query. **'inputCode'**
**'agentName'** needs to have a value that is gotten from the haulmkilling agent query. **'agentCode'** needs to have a value that is gotten from the haulmkilling agent query. This is not an item code!!!
**'inputType'** needs to have a value that is gotten from the haulmkilling agent query. **'inputType'** "wdvi" or "ndvi"
**'selectedOption'** needs to have a value that is gotten from the haulmkilling agent query. **'selectedOption'** needs to have a value that is gotten from the haulmkilling agent query.
The given agent values(agentName, inputType and selectedOption) as specified above form a unique combination specifying correct agent data.
For example, the agent with **'agentName'** needs to have an entry of **'inputType'** with a constant object with the **"option"** key and value **'selectedOption'**.
```javascript
{
"name": "<agentName>",
"values": {
"<inputType>": [
{
"max": 0.9,
"min": 0.25,
"fexp": 2.97,
"fmul": 0.25,
"option": "<selectedOption>"
}
]
}
}
```
##### Optional input parameters ##### ##### Optional input parameters #####
There are some optional task attribute input parameters for greater flexibility. There are some optional task attribute input parameters for greater flexibility.