Writes specified value to the GDB group.

CLI Example

Command syntax:

global_db write 
-group <group_name> 
-key <key_name> 
-value <value>

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)
-value - any value which you want to write in the specified GDB group ("It can be any data that can be represented as a string in quotes")

Example:

Command:

cellframe-node-cli global_db write 
-group local.personal 
-key mykey 
-value myvalue

Response:

        group name: foobar.nodes.list
        keys list:
 
                key: 69A4::0747::002F::6C3C
                time: Thu, 26 Sep 2024 04:01:51 +0000
                type: record
                
                key: 004F::C294::1912::CEF6
                time: Thu, 26 Sep 2024 04:01:51 +0000
                type: record
 
                key: 0737::46BB::BD54::9B12
                time: Thu, 26 Sep 2024 04:01:51 +0000
                type: record
 
                key: B671::E83E::ED7E::7FC8
                time: Thu, 26 Sep 2024 04:01:51 +0000
                type: record
 
                key: C5DC::CEC6::16B1::D8C7
                time: Thu, 26 Sep 2024 04:01:52 +0000
                type: record
 
                key: 17CD::9A15::709D::FEDD
                time: Thu, 26 Sep 2024 04:11:03 +0000
                type: record

JSON-RPC Example

JSON-RPC Request - GLOBAL_DB WRITE

Writes specified value to the GDB group.

Request Structure

JSON object:

{
  "method": "global_db",
  "subcommand": ["write"],
  "arguments": {
    "group": "group_name",
    "key": "key_name",
    "value": "value"
  },
  "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) value - any value which you want to write in the specified GDB group (“It can be any data that can be represented as a string in quotes”)

Curl Example

Request:

curl --unix-socket /opt/cellframe-node/var/run/node_cli -X POST http://localhost/connect -d '{
  "method": "global_db",
  "subcommand": ["write"],
  "arguments": {
    "group": "local.general",
    "key": "gdb_version",
    "value": "string in quotes"
  },
  "id": "1"
}'

Response:

{
  "type": 2,
  "result": [
    {
      "write status": "Data has been successfully written to the database"
    }
  ],
  "id": 1
}
Link to original