Removes information from the group via the specified key. For example, it can be node address or order hash.

CLI Example

Command syntax:

global_db delete 
-group <group_name> 
-key <key_name>

Options:

-group - name of the group (list of names can be acquired using GROUP_LIST command)
-key - key for access the group (list of keys can be acquired using GET_KEYS command)

Command:

cellframe-node-cli global_db delete 
-group local.personal 
-key mykey

Response:

        Record key: mykey
        Group name: local.personal
        status: deleted

JSON-RPC Example

JSON-RPC Request - GLOBAL_DB DELETE

Removes information from the group via the specified key. For example, it can be node address or order hash.

Request Structure

JSON object:

{
  "method": "global_db",
  "subcommand": ["delete"],
  "arguments": {
    "group": "group_name",
    "key": "key_name"
  },
  "id": "1"
}

Parameters:

group - name of the group (list of names can be acquired using JSON-RPC Request - GLOBAL_DB GROUP_LIST) key - key for access the group (list of keys can be acquired using JSON-RPC Request - GLOBAL_DB GET_KEYS)

Curl Example #1 (fail)

Request:

curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '
{
  "method": "global_db",
  "subcommand": ["delete"],
  "arguments": {
    "group": "scorpion.orders.stake.approved",
    "key": "0xA247F0E8F903A8A9B2C7D378F8114A590CD5117DFF8EE7F54AF5C0F48222AA16"
  },
  "id": "1"
}'

Response:

The deletion was failed because of lack of permissions.

{
  "type": 2,
  "result": [
    {
      "errors": [
        {
          "code": 14,
          "message": "Record with key scorpion.orders.stake.approved in group 0xA247F0E8F903A8A9B2C7D378F8114A590CD5117DFF8EE7F54AF5C0F48222AA16 deleting failed"
        }
      ]
    }
  ],
  "id": 1
}

Curl Example #2 (success)

Request:

curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '
{
  "method": "global_db",
  "subcommand": ["delete"],
  "arguments": {
    "group": "local.personal",
    "key": "mykey2"
  },
  "id": "1"
}'

Response:

{
  "type": 2,
  "result": [
    {
      "Record key": "mykey2",
      "Group name": "local.personal",
      "status": "deleted"
    }
  ],
  "errors": null,
  "id": 1
}
Link to original