AI Network
Search…
Database API

ain_get

Returns the value, write rule, owner rule, or function at the given path in the global state tree.

Parameters

Name
Type
Description
type
String
"GET_VALUE" | "GET_RULE" | "GET_FUNCTION" | "GET_OWNER" | "GET"
ref
String
The path to get a value/write rule/owner rule/function of. Only required if the type is not "GET".
op_list
Array
An array of get requests ({ type, ref, [is_shallow, is_global, is_final, include_tree_info, include_proof, include_version] }). Only required if the type is "GET"
is_shallow
Boolean | Undefined
An optional get request parameter. When specified as true, the shallow result (only the keys of the children) will be returned.
is_global
Boolean | Undefined
An optional get request parameter. When specified as true, the given ref will be interpreted as a global path.
is_final
Boolean | Undefined
An optional get request parameter. When specified as true, the finalization result will be returned.
include_tree_info
Boolean | Undefined
An optional get request parameter. When specified as true, the result will include additional state tree information.
include_proof
Boolean | Undefined
An optional get request parameter. When specified as true, the result will include state proof hashes.
include_version
Boolean | Undefined
An optional get request parameter. When specified as true, the result will include state versions.

Returns

The Array of data/rule/owner data/function hash at each path. The order will be preserved, and if there isn't data present at the path, null will be at the path's index.

Example

// "GET" Request curl -X POST --data '{ "jsonrpc":"2.0", "id":1, "method":"ain_get", "params":{ "type": "GET" "op_list": [ {"ref": "afan/user123/balance","type": "GET_VALUE"}, {"ref": "afan/$userId","type": "GET_RULE"} ] } }' // Response { "jsonrpc":"2.0", "id":1, "result":[1000, {".rule": {"write": "'$userId' === auth"}}] }
Last modified 20d ago