Prohlížíte starou verzi této stránky. Zobrazit aktuální verzi.

Porovnat s aktuální Zobrazit historii stránky

« Předchozí Verze 15 Další »

Funkce /api/get vrací stav zařízení. Odpověď je ve formátu JSON.

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?

Požadavek
POST {
        "param": [
          "sntp_enable",
          "sntp_server",
          "sntp_timeout",
          "sntp_period",
          "dev_sn",
          "test_wr_param"
        ]
      }

nebo
POST {
        "param": [] //returns all existing parameters
      }


Odpověď je ve formátu json.

Odpověď
 POST {
      "status": { 							// return unread parameters
        "sntp_timeout": "undefined",
        "test_wr_param": "access_denied"
      },
      "value": {							// returns read parameters
        "sntp_enable":"no",
        "sntp_server": "ntp.cesnet.cz",
        "sntp_period": 2,
        "dev_sn": "00000013"
      }
    }

To get the reading of parameter value.

Request

  • Urn:              /api/get
  • Method:      POST
  • Request header:  Cookie: session  - actual session value.
  • Request content: json
Json 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.

Example
{
        "param": [			// request for reading values of specific parameters
          "sntp_enable",
          "sntp_server",
          "sntp_timeout",
          "sntp_period",
          "dev_sn",
          "test_wr_param"
        ]
      }

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

Response

  • Response code:
    • 200 – OK
    • 500 – Server error
    • 512 - Internal application error
  • Response header:  -
  • Response type: json
Json schema:
{
        "$schema": "http://json-schema.org/draft-04/schema#",
        "type": "object",
        "properties": {
           "deviceType": {
             "type": "string"
           }
        },
        "required": [
          "deviceType",
        ]
     }


Example
{
	"deviceType": "5.1.0.0"
}
  • Žádné štítky