FunkceTo download a file.
Request
...
- download
- Method: POST
- Request header: Cookie: session - actual session value.
- Request content: json
Blok kódu |
---|
| POST /api/upload HTTP/1.1
|
{
Content-Type"$schema": multipart/form-data; boundary=----BoundaryIdentificatorkTrZ
"http://json-schema.org/draft-07/schema#",
Content-Length: 205"title": "passwd - request",
Cookie "type": session=f3a78dd4e51e7
"object",
------BoundaryIdentificatorkTrZu0gW
"properties": {
Content-Disposition: form-data; "name="json"
: {
{"nametype": "firmware"string"
}
------BoundaryIdentificatorkTrZu0gW},
Content-Disposition: form-data; name="file" filename="fw.bin"
required": [
"name"
Content-Type: application/octet-stream
],
(… binary file data …)
------BoundaryIdentificatorkTrZ--"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.