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": "upload - response", "type": "object", "properties": { "status": { "type": "object", "additionalProperties": { "type": "string", "minLength": 1, "pattern": "^[a-z_][a-z0-9_]*$" } } }, "additionalProperties": false } |
Meaning of json items:
{ "status": { "cfg_update ": "busy" } } |