Update page 'VRAPoten API'

This commit is contained in:
Mark van der Wal 2020-03-10 10:56:00 +00:00
parent b04856e993
commit c42040daa9

View File

@ -46,118 +46,7 @@ https://farmmaps.awtest.nl/swagger/index.html
[Create Cropfield](https://git.akkerweb.nl/FarmMaps/Documentatie/wiki/Create-cropfield)
###### Uploading own data (optioneel)
If the user wants to upload custom data (lutum/ec) they can use the FarmMaps file API.
The API is based on the google drive API.
* Start request
> Request
```javascript
POST https://farmmaps.awacc.nl/api/v1/file
Host: farmmaps.awtest.nl
Authorization: Bearer < Token >
X-Upload-Content-Length: 13507747
X-Upload-Content-Type: application/x-zip-compressed
Content-Type: application/json; charset=UTF-8
Content-Length: 181
{
"name":"Grondsoorten2006-SHP.zip",
"mimeType":"application/x-zip-compressed",
"size":13507747,
"lastModified":1575293019617,
"parentCode":"c0787987a3f7449c97eecd6d015eb4c2:USER_FILES"
}
```
> Response
```javascript
Location: /api/v1/file/2831cd05ddc0415784930059c658db55
Content-Length: 194
Content-Type: application/json; charset=utf-8
{
"code":"2831cd05ddc0415784930059c658db55",
"chunks":1,
"parentCode":"c0787987a3f7449c97eecd6d015eb4c2:USER_FILES",
"name":"Grondsoorten2006-SHP.zip",
"size":13507747,
"chunkSize":13507747,
"data":{}
}
```
* Request upload chunk 1
> Request
```javascript
PUT https://farmmaps.awtest.nl/api/v1/file/2831cd05ddc0415784930059c658db55
Host: farmmaps.awtest.nl
Authorization: Bearer < Token >
Content-Type: application/octet-stream
Content-Length: 2097152
Content-Range: bytes 0-2097151/13507747
<data>
```
> Response
```javascript
HTTP/1.1 308 Resume Incomplete
Range: 0-2097151
Content-Length: 17
Resume Incomplete
```
* Request upload chunk 2
> Request
```javascript
PUT https://farmmaps.awtest.nl/api/v1/file/2831cd05ddc0415784930059c658db55
Host: farmmaps.awtest.nl
Authorization: Bearer < Token >
Content-Type: application/octet-stream
Content-Length: 2097152
Content-Range: bytes 2097152-4194303/13507747
<data>
```
> Response
```javascript
HTTP/1.1 308 Resume Incomplete
Range: 0-4194303
Content-Length: 17
Resume Incomplete
```
* Final request
> Request
```javascript
PUT https://farmmaps.awtest.nl/api/v1/file/2831cd05ddc0415784930059c658db55
Host: farmmaps.awtest.nl
Authorization: Bearer < Token >
Content-Type: application/octet-stream
Content-Length: 924835
Content-Range: bytes 12582912-13507746/13507747
<data>
```
> Response
```javascript
Upload response laatste chunk
HTTP/1.1 201 Created
Range: 0-13507746
Content-Length: 0
```
[Upload Data](https://git.akkerweb.nl/FarmMaps/Documentatie/wiki/Upload-data)
###### Creating appliance maps
Execute the VRAPotenTask with the item code of the cropfield as parameter inside {code}.