Funkce /api/donwload slouží ke stažení souboru (JAKÉHO?). Formát odpovědi závisí na typu stahovaného obsahu application/octet-stream, application/json apod.
Blok kódu | ||
---|---|---|
| ||
POST /api/upload HTTP/1.1
Content-Type: multipart/form-data; boundary=----BoundaryIdentificatorkTrZ
Content-Length: 205
Cookie: session=f3a78dd4e51e7
------BoundaryIdentificatorkTrZu0gW
Content-Disposition: form-data; name="json"
{"name":"firmware"}
------BoundaryIdentificatorkTrZu0gW
Content-Disposition: form-data; name="file" filename="fw.bin"
Content-Type: application/octet-stream
(… binary file data …)
------BoundaryIdentificatorkTrZ-- |
...
To download a file.
To write the parameter value.
Request
- Urn: /api/donwload
- Method: POST
- Request header: Cookie: session - actual session value.
- Request
...
Multipart items:
Poznámka |
---|
|
item: name="json":
A string item with the json structure.
Json schema for multipart item "json":
...
- content: json
Blok kódu | ||
---|---|---|
| ||
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": " |
...
passwd - request", "type": "object", "properties": { |
...
"name": { |
...
"type": "string" |
...
} }, |
...
"required": [ |
...
"name" |
...
], "additionalProperties": false } |
Meaning of json items:
- $.name:
File type content definition; defined by parameter name.
Type: string.
Mandatory.
Blok kódu | ||
---|---|---|
| ||
{ |
...
"name |
...
" |
...
: "fw_file“
} |
Response
- Response code:
- 200 – OK
- 400 – Error (bad request)
- 401 – Unauthorized
- 500 – Server error
- 512 - Internal application error
- Response header: Set-Cookie: session - Actual session value.
- Response type: Data type is depending on the content of the downloaded file. (application/octet-stream, application/json,…)
- Response content: Occurs only for response code = 200.