Get table details
Use this API to get table details, including Meta information (column format, name, and view) and data rows.
This API returns at most 500 rows; if there is over 500 rows in the table, use lastSegmentRowID
as the offset.
If lastSegmentRowID is empty (1-500 data reads), then both Meta information and data rows are returned; otherwise, only data rows are returned.
Request
curl -vvv "$API_HOST/open/api/v1/tablenodes/$id/partial/" -H "Content-Type: application/json" -H "Authorization: $access-token" -d '{}'
Response
Name | Type | Requried | Description |
---|---|---|---|
viewID | string | NO | View ID,blank for the default view |
lastSegmentRowID | string | NO | The offset of table rows |
Response example
{
lastSegmentRowID: "5349b4ddd2781d08c09890f3",
viewID: "5349b4ddd2781d08c09890f3"
}
Python example
def read_table(access_token, table_id, view_id, last_rowid):
url = '%s/open/api/v1/tablenodes/%d/partial/' % (API_HOST, table_id)
data = {}
if view_id:
data['viewID'] = view_id
if last_rowid:
data['lastSegmentRowID'] = last_rowid
headers = {'Authorization': access_token}
req = requests.get(url, json=data, headers=headers)
return req.json()
Response
Response body
Name | Type | Description |
---|---|---|
detail | object | Table detail |
∟ id | int64 | Table ID |
∟ type | string | Table type: table, bigTable, group |
∟ segmentType | string | segmentStart if this is the 1st partition of table, segmentFrame otherwise |
∟ more | boolean | Is this partition hit the end of table |
∟ columns | array | Column data, return when segmentType == segmentStart |
∟ rows | array | Row data |
∟ views | array | View list, return when segmentType == segmentStart |
∟ rows | array | View rows |
∟ columns | array | View columns |
Response body example
{
"code": 0,
"msg": "success",
"detail": {
"id": 1,
"type": "table",
"segmentType": "segmentStart",
"rows": [
{
"id": "61ca7730aeb6fdcb5a6cfcd5",
"cells": {
"620a0e9ef5f9e0fbec16049e": "Tanghekou Town",
"620a0e9ef5f9e0fbec16049f": 2
},
"meta": {
"createTime": "0001-01-01T00:00:00Z",
"updateTime": "0001-01-01T00:00:00Z",
"creatorID": 0,
"updaterID": 0
}
},
"columns": [
{
"id": "620a0e9ef5f9e0fbec16049e",
"syncedID": "000000000000000000000000",
"tableNodeID": 0,
"name": "a",
"type": "singleLineText",
"typeOptions": null,
"isPrimary": true,
"mode": "normal",
"meta": {
"createTime": "0001-01-01T00:00:00Z",
"updateTime": "0001-01-01T00:00:00Z",
"creatorID": 0,
"updaterID": 0
}
}
],
"views": [
{
"id": "620a0e9ef5f9e0fbec16049d",
"name": "New view",
"order": 1,
"frozenColumnCount": 1,
"filterCondition": "and",
"filters": [],
"groups": null,
"orders": null,
"rows": [
{
"id": "61ca7730aeb6fdcb5a6cfcd5",
"order": 1
},
{
"id": "61ca7730aeb6fdcb5a6cfcd6",
"order": 2
},
{
"id": "61ca7730aeb6fdcb5a6cfcd7",
"order": 3
}
],
"columns": [
{
"id": "620a0e9ef5f9e0fbec16049e",
"order": 1,
"width": 200,
"isHidden": false
},
{
"id": "620a0e9ef5f9e0fbec16049f",
"order": 2,
"width": 200,
"isHidden": false
}
]
}
]
}
}