Skip to main content

Endpoints

Make API calls to get table and validator information.


Synopsis

This general API specification is used to automatically generate clients and backend services; it should be used as the primary source of truth for Gateway APIs. This specification is a living document, and as such, may be updated over time. Proposals for the addition of API features and fixes may be submitted by the Tableland community over time. These proposals will be evaluated for technical feasibility, utility to the community, and longer-term sustainability.

In Tableland, Validators are the execution unit/actors of the protocol. They have the following responsibilities:

  • Listen to on-chain events to materialize Tableland-compliant SQL queries in a database engine (currently, SQLite by default).
  • Serve read-queries (e.g: SELECT * FROM foo_69_1) to the external world.
  • Serve state queries (e.g. list tables, get receipts, etc) to the external world.

query

See the Query Formatting section for how to transform the response, such as making it ERC721 compliant.

Query the network

Example

### You can also use wget
curl -X GET https://testnets.tableland.network/api/v1/query?statement=select%20%2A%20from%20healthbot_80001_1 \
-H 'Accept: application/json'

GET /query

Returns the results of a SQL read query against the Tableland network

Parameters

NameInTypeRequiredDescription
statementquerystringtrueThe SQL read query statement
formatquerystringfalseThe requested response format:
extractquerybooleanfalseWhether to extract the JSON object from the single property of the surrounding JSON object.
unwrapquerybooleanfalseWhether to unwrap the returned JSON objects from their surrounding array.

Detailed descriptions

format: The requested response format:

  • objects - Returns the query results as a JSON array of JSON objects.
  • table - Return the query results as a JSON object with columns and rows properties.

Enumerated Values

ParameterValue
formatobjects
formattable

Example responses

  • 200 Response
{}

Responses

StatusMeaningDescriptionSchema
200https://tools.ietf.org/html/rfc7231#section-6.3.1Successful operationInline
400https://tools.ietf.org/html/rfc7231#section-6.5.1Invalid query/statement valueNone
404https://tools.ietf.org/html/rfc7231#section-6.5.4Row Not FoundNone
429https://tools.ietf.org/html/rfc6585#section-4Too Many RequestsNone

Response Schema

This operation does not require authentication

receipt

Get information about transaction progress

Get transaction status

Example

### You can also use wget
curl -X GET https://testnets.tableland.network/api/v1/receipt/{chainId}/{transactionHash} \
-H 'Accept: application/json'

GET /receipt/{chainId}/{transactionHash}

Returns the status of a given transaction receipt by hash

Parameters

NameInTypeRequiredDescription
chainIdpathinteger(int32)trueThe parent chain to target
transactionHashpathstringtrueThe transaction hash to request

Example responses

  • 200 Response
{
"table_id": "1",
"table_ids": [
"1",
"2"
],
"transaction_hash": "0x02f319429b8a7be1cbb492f0bfbf740d2472232a2edadde7df7c16c0b61aa78b",
"block_number": 27055540,
"chain_id": 80001,
"error": "The query statement is invalid",
"error_event_idx": 1
}

Responses

StatusMeaningDescriptionSchema
200https://tools.ietf.org/html/rfc7231#section-6.3.1successful operationTransactionReceipt
400https://tools.ietf.org/html/rfc7231#section-6.5.1Invalid chain identifier or transaction hash formatNone
404https://tools.ietf.org/html/rfc7231#section-6.5.4No transaction receipt found with the provided hashNone
429https://tools.ietf.org/html/rfc6585#section-4Too Many RequestsNone

This operation does not require authentication

tables

Access to table information

Get table information

Example

### You can also use wget
curl -X GET https://testnets.tableland.network/api/v1/tables/{chainId}/{tableId} \
-H 'Accept: application/json'

GET /tables/{chainId}/{tableId}

Returns information about a single table, including schema information

Parameters

NameInTypeRequiredDescription
chainIdpathinteger(int32)trueThe parent chain to target
tableIdpathstringtrueTable identifier

Example responses

  • 200 Response
{
"name": "healthbot_80001_1",
"external_url": "https://testnets.tableland.network/api/v1/tables/80001/1",
"animation_url": "https://tables.testnets.tableland.xyz/80001/1.html",
"image": "https://tables.testnets.tableland.xyz/80001/1.svg",
"attributes": {
"display_type": "date",
"trait_type": "created",
"value": 1657113720
},
"schema": {
"columns": [
{
"name": "id",
"type": "integer",
"constraints": ["NOT NULL", "PRIMARY KEY", "UNIQUE"]
}
],
"table_constraints": ["PRIMARY KEY (id)"]
}
}

Responses

StatusMeaningDescriptionSchema
200https://tools.ietf.org/html/rfc7231#section-6.3.1successful operationnotion://www.notion.so/textile/REST-API-Latest-e622f52063314c0db8dca75363ebb793#schematable
400https://tools.ietf.org/html/rfc7231#section-6.5.1Invalid chain or table identifierNone
404https://tools.ietf.org/html/rfc7231#section-6.5.4Table Not FoundNone
429https://tools.ietf.org/html/rfc6585#section-4Too Many RequestsNone
500https://tools.ietf.org/html/rfc7231#section-6.6.1Internal Server ErrorNone

This operation does not require authentication

health

Get health status

Example

### You can also use wget
curl -X GET https://testnets.tableland.network/api/v1/health

GET /health

Returns OK if the validator considers itself healthy.

Responses

StatusMeaningDescriptionSchema
200https://tools.ietf.org/html/rfc7231#section-6.3.1The validator is healthy.None

This operation does not require authentication

version

Get version information

Example

### You can also use wget
curl -X GET https://testnets.tableland.network/api/v1/version \
-H 'Accept: application/json'

GET /version

Returns version information about the validator daemon.

Example responses

  • 200 Response
{
"version": 0,
"git_commit": "79688910d4689dcc0991a0d8eb9d988200586d8f",
"git_branch": "foo/experimentalfeature",
"git_state": "dirty",
"git_summary": "v1.2.3_dirty",
"build_date": "2022-11-29T16:28:04Z",
"binary_version": "v1.0.1"
}

Responses

StatusMeaningDescriptionSchema
200https://tools.ietf.org/html/rfc7231#section-6.3.1successful operationVersionInfo

This operation does not require authentication

Response schemas

Table

{
"name": "healthbot_80001_1",
"external_url": "https://testnets.tableland.network/api/v1/tables/80001/1",
"animation_url": "https://tables.testnets.tableland.xyz/80001/1.html",
"image": "https://tables.testnets.tableland.xyz/80001/1.svg",
"attributes": {
"display_type": "date",
"trait_type": "created",
"value": 1657113720
},
"schema": {
"columns": [
{
"name": "id",
"type": "integer",
"constraints": ["NOT NULL", "PRIMARY KEY", "UNIQUE"]
}
],
"table_constraints": ["PRIMARY KEY (id)"]
}
}

Properties

NameTypeRequiredRestrictionsDescription
namestringfalsenonenone
external_urlstringfalsenonenone
animation_urlstringfalsenonenone
imagestringfalsenonenone
attributes[object]falsenonenone
» display_typestringfalsenoneThe display type for marketplaces
» trait_typestringfalsenoneThe trait type for marketplaces
» valueobjectfalsenoneThe value of the property

oneOf

NameTypeRequiredRestrictionsDescription
»» anonymousstringfalsenonenone

xor

NameTypeRequiredRestrictionsDescription
»» anonymousnumberfalsenonenone

xor

NameTypeRequiredRestrictionsDescription
»» anonymousintegerfalsenonenone

xor

NameTypeRequiredRestrictionsDescription
»» anonymousbooleanfalsenonenone

xor

NameTypeRequiredRestrictionsDescription
»» anonymousobjectfalsenonenone

continued

NameTypeRequiredRestrictionsDescription
schemaSchemafalsenonenone

TransactionReceipt

{
"table_id": "1",
"table_ids": [
"1",
"2"
],
"transaction_hash": "0x02f319429b8a7be1cbb492f0bfbf740d2472232a2edadde7df7c16c0b61aa78b",
"block_number": 27055540,
"chain_id": 80001,
"error": "The query statement is invalid",
"error_event_idx": 1
}

Properties

NameTypeRequiredRestrictionsDescription
table_idstringfalsenoneThis field is deprecated
table_ids[string]falsenonenone
transaction_hashstringfalsenonenone
block_numberinteger(int64)falsenonenone
chain_idinteger(int32)falsenonenone
errorstringfalsenonenone
error_event_idxinteger(int32)falsenonenone

Schema

{
"columns": [
{
"name": "id",
"type": "integer",
"constraints": ["NOT NULL", "PRIMARY KEY", "UNIQUE"]
}
],
"table_constraints": ["PRIMARY KEY (id)"]
}

Properties

NameTypeRequiredRestrictionsDescription
columns[Column]falsenonenone
table_constraints[string]falsenonenone

Column

{
"name": "id",
"type": "integer",
"constraints": ["NOT NULL", "PRIMARY KEY", "UNIQUE"]
}

Properties

NameTypeRequiredRestrictionsDescription
namestringfalsenonenone
typestringfalsenonenone
constraints[string]falsenonenone

VersionInfo

{
"version": 0,
"git_commit": "79688910d4689dcc0991a0d8eb9d988200586d8f",
"git_branch": "foo/experimentalfeature",
"git_state": "dirty",
"git_summary": "v1.2.3_dirty",
"build_date": "2022-11-29T16:28:04Z",
"binary_version": "v1.0.1"
}

Properties

NameTypeRequiredRestrictionsDescription
versioninteger(int32)falsenonenone
git_commitstringfalsenonenone
git_branchstringfalsenonenone
git_statestringfalsenonenone
git_summarystringfalsenonenone
build_datestringfalsenonenone
binary_versionstringfalsenonenone

Interactive demo

Test out the Gateway API yourself: here