Tables

Tables Api

Get table item (v2)

post
/rpc/v2/tables/{table_handle}/item

Get the value at the key specified in the request body from the Move table identified by the {table_handle} path parameter. The key must be represented as an instance of key_type in the Move state, and the value must be represented as an instance of value_type. If either the key or the value cannot be parsed into the corresponding type then the API will return status code 400.

Example of body

{
  "key_type": "u64",
  "value_type": "0x1::multisig_voting::Proposal<0x1::governance_proposal::GovernanceProposal>",
  "key": "12"
}
{
  "key_type": "u64",
  "value_type": "0x1::string::String",
  "key": "42"
}
Path parameters
table_handlestringRequired

Table handle to lookup. Should be a valid Move address retrieved from the account resources API.

Body

Describes body of the Table item request by item key.

key_typestringRequired

String representation of an on-chain Move type tag that is exposed in transaction payload. Values:

  • bool
  • u8
  • u16
  • u32
  • u64
  • u128
  • u256
  • address
  • signer
  • vector: vector<{non-reference MoveTypeId}>
  • struct: {address}::{module_name}::{struct_name}::<{generic types}>

Vector type value examples:

  • vector<u8>
  • vector<vector<u64>>
  • vector<0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>>

Struct type value examples:

  • 0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>
  • 0x1::account::Account

Note:

  1. Empty chars should be ignored when comparing 2 struct tag ids.
  2. When used in a URL path, should be encoded by url-encoding (AKA percent-encoding).
value_typestringRequired

String representation of an on-chain Move type tag that is exposed in transaction payload. Values:

  • bool
  • u8
  • u16
  • u32
  • u64
  • u128
  • u256
  • address
  • signer
  • vector: vector<{non-reference MoveTypeId}>
  • struct: {address}::{module_name}::{struct_name}::<{generic types}>

Vector type value examples:

  • vector<u8>
  • vector<vector<u64>>
  • vector<0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>>

Struct type value examples:

  • 0x1::coin::CoinStore<0x1::aptos_coin::AptosCoin>
  • 0x1::account::Account

Note:

  1. Empty chars should be ignored when comparing 2 struct tag ids.
  2. When used in a URL path, should be encoded by url-encoding (AKA percent-encoding).
keyanyRequired

The value of the table item's key.

Responses
200

Item of the table

application/json
Responseone of

An enum of the possible Move value types.

or
or
or
or
or
or
or
or
or
or
or
post
/rpc/v2/tables/{table_handle}/item
POST /rpc/v2/tables/{table_handle}/item HTTP/1.1
Host: rpc-testnet.supra.com
Content-Type: application/json
Accept: */*
Content-Length: 50

{
  "key_type": "text",
  "value_type": "text",
  "key": null
}
{
  "U8": 1
}

Last updated