5.14.4 api dir delete

The /api/dir/delete function deletes an array of entries in the directory.


Methods

  • PUT


Request

The request contains parameters in the application/json format.


Table 1. Request JSON Keys
Key NameMandatoryExpected ValuesDefault ValueDescription

owner

Yes if users is omitted

a string

-

All entries in the directory with the specified owner are deleted

users

Yes if owner is omitted

array of JSON objects defining uuids

-

The array has to contain at least one object with the key uuid, which defines the entry that is to be deleted.

Example of Request

URL: https://192.168.1.1/api/dir/delete JSON (owner specified) { "owner": "My2N" } JSON (uuid specified) { "users": [ { "uuid": "01234567-89AB-CDEF-0123-456789ABCDEF" }, { "uuid": "76543210-68FF-18CA-3210-FEDCBA987654" }, { "uuid": "76543210-68FF-18-3210-FEDCBA987654" } ] }

If there is no entry in the directory with the specified owner, an empty array is returned.


If there is no entry in the directory with uuid 01234567-89AB-CDEF-0123-456789ABCDEF, the device will respond with an error code (see below). Similarly for the second uuid 76543210-68FF-18CA-3210-FEDCBA987654.


If the entry with uuid 01234567-89AB-CDEF-0123-456789ABCDEF is present, it will be deleted. Similarly for the second uuid 76543210-68FF-18CA-3210-FEDCBA987654.

The third uuid has a wrong format and an error is returned.


Response

The response is in the application/json format. The result object contains the keys series and users.


Go to the topic api/dir/query to get more information on the use of the key series.


The key users contains an array of objects that contain keys uuid and timestamp.


  • You can get better acquainted with the structure of the JSON response in the example at the end of this topic.
Table 2. Response JSON Keys in the users Array
KeyTypical Returned ValuesDescription

uuid

uuid

Unique User Identifier of a deleted or unchanged entry.

timestamp

integer

A timestamp of performed changes in the directory. Go to the topic api/dir/query to get more information on the use of the timestamp. The timestamp is present only when a change in the directory was successful.

errors

array of error objects

An error object containing an array of all errors that occured. errors object is present only when a change in the directory failed.

It contains an error code in the key code showing a reason for the failure of a change in the directory.

The following error codes may be returned in a response:

  • EDIR_UUID_DOES_NOT_EXIST - entry with the given uuid does not exist (i.e. cannot be deleted).

  • EDIR_UUID_INVALID_FORMAT - uuid is not in the valid format, which is "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX", where X can be any hexadecimal digit. All zeroes are reserved as an empty uuid.



Example of Response

{ "success": true, "result": { "series": "6423407687606431951", "users": [ { "uuid": "01234567-89AB-CDEF-0123-456789ABCDEF", "timestamp": 39 }, { "uuid": "76543210-68FF-18CA-3210-FEDCBA987654", "errors": [ { "code": "EDIR_UUID_DOES_NOT_EXIST" } ] }, { "uuid": "76543210-68FF-18-3210-FEDCBA987654", "errors": [ { "code": "EDIR_UUID_INVALID_FORMAT" } ] } ] } }

The first entry in the directory is deleted successfully, its uuid and timestamp of the change are returned.


The second entry does not exist (no entry with such uuid).


The third object has a wrong format of uuid.