Update 'Blight-API.md'
Added extra step
This commit is contained in:
parent
49f9418bc5
commit
f8a0e2f5d9
@ -33,6 +33,8 @@ It is also possible to create a new advice at any time, see [Create blight advic
|
|||||||
A blight advice is a child record of a crop field.
|
A blight advice is a child record of a crop field.
|
||||||
Use the crop field code to get the latest blight advice.
|
Use the crop field code to get the latest blight advice.
|
||||||
|
|
||||||
|
#### 1. get the blight item code
|
||||||
|
|
||||||
> Request
|
> Request
|
||||||
```javascript
|
```javascript
|
||||||
GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight
|
GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight
|
||||||
@ -43,46 +45,46 @@ GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight
|
|||||||
{
|
{
|
||||||
"parentCode": "string",
|
"parentCode": "string",
|
||||||
"geometry": ...
|
"geometry": ...
|
||||||
"data": {
|
"url": ...
|
||||||
"advices": [
|
"code": ...
|
||||||
{
|
"data": ...
|
||||||
"date": "2021-03-19T00:00:00",
|
"size": ...
|
||||||
"weather": [
|
|
||||||
{
|
|
||||||
"hh": 0,
|
|
||||||
"rain": 0.0,
|
|
||||||
"humidity": 90.0,
|
|
||||||
"irrigation": 0.0,
|
|
||||||
"temperature": 2.0,
|
|
||||||
"precipitation": 0.0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"hh": 1,
|
|
||||||
"rain": 0.0,
|
|
||||||
"humidity": 91.0,
|
|
||||||
"irrigation": 0.0,
|
|
||||||
"temperature": 1.0,
|
|
||||||
"precipitation": 0.0
|
|
||||||
},...],
|
|
||||||
"sprayTime": null,
|
|
||||||
"sprayType": 3,
|
|
||||||
"ooSporesRisk": false,
|
|
||||||
"fungicideLeftPct": 0,
|
|
||||||
"sprayEffectivity": null,
|
|
||||||
"unprotectedGrowth": 0.0,
|
|
||||||
"tuberInfectionRisk": false,
|
|
||||||
"infectionRiskPerHour": [
|
|
||||||
0,...]
|
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The data object contains the advices from emergence date and weather from planting date.
|
|
||||||
The date property respresents the advice date, the weather array contains 24 objects, 1 for each hour.
|
|
||||||
> Response 404 Not Found
|
> Response 404 Not Found
|
||||||
|
|
||||||
There is no advice available, try to create a new advice, see [Create blight advice](#create-advice).
|
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
|
### <a name="create-advice"></a>Create blight advice
|
||||||
Task 'vnd.farmmaps.task.blight' must be executed to create an advice.
|
Task 'vnd.farmmaps.task.blight' must be executed to create an advice.
|
||||||
@ -144,7 +146,7 @@ GET api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.user.input
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
Get the first objecy of the array, change the data, and push the object back.
|
Get the first object of the array, change the data, and push the object back.
|
||||||
Use the code from the response above.
|
Use the code from the response above.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
Loading…
Reference in New Issue
Block a user