Porovnat verze

Klíč

  • Tento řádek byl přidán.
  • Tento řádek byl odstraněn.
  • Formátování bylo změněno.

...

  • 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
    titleCaution
    • It‘s necessary to keep the order of these items.


    1. name="json": A string item with the json structure.

      Blok kódu
      titleJson schema
      {
            "$schema": "http://json-schema.org/draft-07/schema#",
            "title": "upload - request",
            "type": "object",
            "properties": {
                 "name": {
                     "type": "string"
                 }
            },
            "required": [
                 "name"
            ],
            "additionalProperties": false
      }


    2. name="file":Binary/text file data to send.
  • Meaning of json items:
    • Json string with the following content:
      • $.

    param
    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.
        Mandatory

      • file:
        File content to upload

- request for reading values of specific parameters: { "param": [ // request for reading values of specific parameters "sntp_enable",
Blok kódu
titleExample
Json multipart item example
{
	"name": "config"
}


Blok kódu
titleHttp request example
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

...