To upload a file.
Request content: Multipart items (1. item: name="json" + 2. item: name="file")
|
name="json": A string item with the json structure.
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "upload - request", "type": "object", "properties": { "name": { "type": "string" } }, "required": [ "name" ], "additionalProperties": false } |
$.name:
File type content definition; defined by parameter name.
Type: string.
Mandatory
file:
File content to upload
{ "name": "config" } |
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-- |
{ "$schema": "http://json-schema.org/draft-07/schema#", "title": "prop - response", "type": "object", "properties": { "status": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1, "pattern": "^[a-z_][a-z0-9_]*$" } }, "prop": { "type": "object", "additionalProperties": { "type": "object", "pattern": "^[a-z_][a-z0-9_]*$", "properties": { "type": { "type": "string" }, "size": { "type": "number" }, "access": { "type": "string" }, "enum": { "type": "array", "minItems": 2, "items": { "type": "object", "properties": { "ident": { "type": "string" }, "value": { "type": "number" } }, "required": [ "ident", "value" ] } } }, "restartRequired": { "type": "boolean" }, "required": [ "type", "access" ] } } }, "required": [ "prop" ], "additionalProperties": false } |
Meaning of json items:
$.prop.*.size
Parameter size.
Type: number
Mandatory only for string parameter, not relevant for other types.
$.prop.*.minValue
Parameter minimum value.
Type: number
Optional.
Used for short, int and long type of parameter.
$.prop.*.maxValue
Parameter maximum value.
Type: number
Optional
Used for short, int and long type of parameter.
$.prop.*.enum
Parameter enumeration definition.
Type: array
Optional
Format of list items: "<parameter_name>":"<error_status>"
$.prop.*.regex
Regular expression for parameter value validation.
Type: string
Optional
$.prop.*.restartRequired
Information about require restart after change value of this parameter.
Type: boolean
Optional (default value is false).
{ "status": { "sntp_timeout": "undefined", }, "prop":{ "sntp_enable":{ "type": "short", "access": "rw", "enum": [ { "ident": "no", "value": 0 }, { "ident": "yes", "value": 1 } ] "restartRequired": true }, "sntp_server":{ "type": "string", "size": 254, "access": "rw", "restartRequired": true, "regex": "^((?!-)[0-9A-Za-z-]{1,63}(?<!-)\\.)+[A-Za-z]{2,6}$" }, "sntp_period":{ "type": "integer", "access": "rw", "minValue": 1, "maxValue": 24 }, "dev_fw_version":{ "type": "string", "access": "r" }, "test_wr_only_param":{ "type": "integer", "access": "w" }, "do_adm_restart":{ "type": "action", "access": "" }, "firmware":{ "type": "file", "access": "w" }, "configuration":{ "type": "file", "access": "rw" } } } |