diff --git a/Blight-API.md b/Blight-API.md index ab72d89..42625d2 100644 --- a/Blight-API.md +++ b/Blight-API.md @@ -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. 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 @@ -43,46 +45,46 @@ GET /api/v1/items/{code}/children?it=vnd.farmmaps.itemtype.blight { "parentCode": "string", "geometry": ... - "data": { - "advices": [ - { - "date": "2021-03-19T00:00:00", - "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,...] + "url": ... + "code": ... + "data": ... + "size": ... ... } ``` - -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 - + 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 + ### Create blight 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. ```javascript