Response in JSON format

Top  Previous  Next

To receive a response in the JSON format, add the format=json attribute to the request like the following:

or

<host>—IP address or DNS name of a computer with the Server installed

<object>—managing object: station, group, Server, administrator

available scripts and their parameters are described below

You can receive a JSON response for any URL request that is supported by the Web API 4.1.3.

JSON document contains the following elements:

The head block—service information.

The data block—response data. Content depends on executing operation.

Elements of the head block

Field name

Description

api_version

Current Web API version

local_timestamp

Local time of server. Unix timestamp

timestamp

GMT time of server Unix timestamp

server

Server domain name or IP address

srv_version

Full version of Dr.Web AV-Desk

status

Request status: true—a request has been processed successfully, false—an error occurred, a request has not been processed

For example:

For the following request:

you will receive the following JSON document:

{   "head": {
      "status": true,
      "timestamp": 1395745375,
      "api": {
          "version": 40103
      },
      "server": {
          "name": "192.168.1.1",
          "version": 1000201707130,
          "uuid": "1023dcd7-d11d-b211-896d-8804c0842edb"
      }
  },
  "data": {
      "total": 1,
      "list": [
          {
              "id": "50393916-d21d-b211-a829-e404ce518192",
              "name": "TESTS-PC",
              "created_time": 1395745129,
              "modified_time": 1395745165,
              "parent_id": "1",
              "parent_name": "group1",
              "password": "XLl4upjTjx2ROb7I",
              "state": 1,
              "last_seen_time": 0,
              "last_seen_addr": null,
              "connection": {
                  "port": 2193,
                  "public_key": {
                      "id": "b0b84fcf-d11d-b211-8294-9804ba761cde",
                      "url": "http://ess-server:9080/install/drwcsd.pub",
                      "file": "; Dr.Web (R) Public key file\n; Do not edit!\nb0b84fcf-d11d...D9\n; ***EOF***\n"
                  },
                  "server": "admin-7d6e0c43e"
              },
              "packages": [
                  {
                      "url": "http://ess-server:9080/download/download.ds?id=123&os=windows",
                      "os": "windows",
                      "arch": "all"
                  }
              ],
              "config_url": "http://ess-server:9080/download/download.ds?code=1bTbCTGg5p1",
              "department": null,
              "description": null,
              "country": null,
              "street": null,
              "room": null,
              "city": null,
              "floor": null,
              "longitude": 0,
              "latitude": 0,
              "organization": null,
              "province": null,
              "email": null,
              "user_id": "yyy",

              "acl": {
                  "priority": "allow",
                  "allowed": [],
                  "disallowed": []
              },
              "os_code": 0,
              "os_name": "unknown"
          }
      ]
  }
}

If an error occurred during operation("status":false), then the error block containing an error text and code will be included in the JSON body. An error is described in the message element while an error code is in the code field.

{   "head": {
      "status":false,
      "timestamp":1410867853,
      "api": {
          "version":40103
      },
      "server":{
          "name":"192.168.1.1",
          "version":1000201707130
      }
  },
  "data":{
      "error":{"message":"Necessary parameters are not specified in your request: 'name'","code":11}
  }
}

Error codes are given in the Returned error codes section.

Date and time in all elements of Web API 4.1.3 scripts are returned in the Unix timestamp format.