Porovnat verze

Klíč

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

...

To get the reading of parameter value.

Request

  • Urn:              /api/get

...

Metoda: POST

Klíče:

  • sntp_enable
  • sntp_server
  • sntp_timeout
  • sntp_period
  • dev_sn
  • test_wr_param
  • ??? další

K získání hodnot všech vstupních slouží klíč "param". (když nedám žádný parametr/klíč?), 

Jak vypadá požadavek jen na některé klíče?

...

languagejava
titlePožadavek

...

  • Method:      POST
  • Request header:  Cookie: session  - actual session value.
  • Request content: json
Blok kódu
titleJson schema:
{
      "$schema": "http://json-schema.org/draft-07/schema#",
      "title": "get - request",
      "type": "object",
      "properties": {
        "param": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[a-z_][a-z0-9_]*$"
          }
        }
      },
      "required": [
        "param"
      ],
      "additionalProperties": false
}

Meaning of json items:

    $.param:
       Array with names of configuration parameters to retrieve their values.
       An empty array causes read all parameter values.
         Type:  array
         Optional.

Blok kódu
titleExample
{
        "param": [			// request for reading values of specific parameters
          "sntp_enable",
          "sntp_server",
          "sntp_timeout",
          "sntp_period",
          "dev_sn",
          "test_wr_param"
        ]
      }

nebo
POST//OR
      {
        "param": [ ] 		//returnsrequest for reading all values of existing parameters
      }

...

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 
    Page_break_pdf
POST {
Blok kódu
titleOdpověď
Json schema:
"$schema": "http://json-schema.org/draft-07/schema#",
      "title": "get - response",
      "type": "object",
      "properties": {
        "status": { 							// return unread parameters

          "type": "object",
          "additionalProperties": {
            "sntp_timeouttype": "string",
            "undefinedminLength": 1,
            "test_wr_parampattern": "access_denied^[a-z_][a-z0-9_]*$"
          }
        },
        "value": {							// returns read parameters

          "type": "object",
          "additionalProperties": {
            "sntp_enabletype":"no [
              "string",
              "sntp_server": "ntp.cesnet.cz",
number",
              "boolean"
            ],
         "sntp_period   "minLength": 21,
            "pattern": "dev_sn": "00000013^[a-z_][a-z0-9_]*$"
          }
        }
      },
      "required": [
        "value"
      }],
      "additionalProperties": false
}

To get the reading of parameter value.

Request

  • Urn:              /api/get
  • Method:      POST
  • Request header:  Cookie: session  - actual session value.
  • Request content: json

Response

  • Response code:
    • 200 – OK
    • 500 – Server error
    • 512 - Internal application error
  • Response header:  -
  • Response type: json

...

titleJson schema:

...

Meaning of json items:

  • $.value:
    List of readed parameters.
    Type: object
    List items are in format:
             "<parameter_name>": <parameter_value>
  • $.status:
    List of unread parameter values.
    Is present only for response with response code 400 – Bad request.
    Type: object
    Optional.
    • Format of list items: "<parameter_name>": "<error_status>"
      <parameter_name> – name of reported parameter
      <error_status> – type of error.
    • Possible values:
      "undefined" – parameter not exists
      "no memory" – memory not enough
      "access denied" – parameter is not accessible
      "error" – general internal error
Blok kódu
titleExample
{
      "$schemastatus": "http://json-schema.org/draft-04/schema#",{
        "typesntp_timeout": "objectundefined",
        "propertiestest_wr_param": {"acceses_denied"
      },
      "deviceTypevalue": {
             "typesntp_enable": "stringno",
           }
        }"sntp_server": "ntp.cesnet.cz",
        "requiredsntp_period": [2,
        "dev_sn":  "deviceType00000013",
        ]
     }
Blok kódu
titleExample
{
	"deviceType": "5.1.0.0"
}