...
- Urn: /api/upload
- Method: POST
- Request header: Cookie: session - actual session value.
- Request type: multipart/form-data
Request content: Multipart items (1. item: name="json" + 2. item: name="file")
Poznámka title Caution - It‘s necessary to keep the order of these items.
name="json": A string item with the json structure.
Blok kódu title Json schema { "$schema": "http://json-schema.org/draft-07/schema#", "title": "upload - request", "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ], "additionalProperties": false }
- name="file":Binary/text file data to send.
- Meaning of json items:
- Json string with the following content:
$.
Array with names of configuration parameters to retrieve parameter definitions. An empty array causes read all parameter definitions.name:
File type content definition; defined by parameter name.
Type: string.
Mandatoryfile:
File content to upload
- Json string with the following content:
Blok kódu | ||||
---|---|---|---|---|
| - request for reading values of specific parameters:
{
"param": [ // request for reading values of specific parameters
"sntp_enable",
| |||
{
"name": "config"
} |
Blok kódu | ||
---|---|---|
| ||
POST /api/upload HTTP/1.1 Content-Type: "sntp_server",multipart/form-data; boundary=----BoundaryIdentificatorkTrZ "sntp_timeout",Content-Length: 205 Cookie: session=f3a78dd4e51e7 "sntp_period",------BoundaryIdentificatorkTrZu0gW Content-Disposition: "def_fw_version",form-data; name="json" "test_wr_only_param", {"name":"firmware"} ------BoundaryIdentificatorkTrZu0gW Content-Disposition: form-data; name="device_restartfile" ] } //OR { // request for reading values for all existing parameters (empty array): "param": [] } filename="fw.bin" Content-Type: application/octet-stream (… binary file data …) ------BoundaryIdentificatorkTrZ-- |
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: json
...