Get Rows#
Query data from the table.
POST https://api.cloudplan.net/api/tables/get_rows
Request Parameters#
{
"table_id": "",
"query": {},
"limit": 0,
"skip": 0,
"projection": [],
"sort_by": "",
"sort_dir": 1,
"pipeline": []
}
table_id | (string)
Id of the table to query.
query | (optional) (object)
A filter object for the datatable, see Query Filters below for options.
default: {}
limit | (optional) (integer)
Return no more than this number of rows.
default: 100 - this also the maximum
skip | (optional) (integer)
Skip this many rows. Together with limit this implements paging of the result.
default: 0
projection | (optional) (list of strings)
A list of columns (cx’s’) to include in the result.
Example: ['c0', 'c1'] returns only first two columns.
default: []
sort_by | (optional) (string)
Sort by this column cx. Default sorting is by order of insertion, oldest first.
default: ‘’
sort_dir | (optional) (integer)
Gives the direction of sorting. Possible values are:
1 -> ascending
-1 -> descending
default: 1
pipeline | (optional) (list of pipeline stage objects)
A aggregation pipeline, used instead of the query parameter for complex data retrieval. If specified, the query parameter is ignored. See Aggregation Pipeline for more info.
Examples#
Here are some examples for using get_rows. Assume we have the following table definition and stored rows. Some ids and paramters in the objects have been omitted for better readability.
{
"table_id": "6960D3994737607552574B980961708E",
"name": "example table"
"col_settings": {
"c0": {
"name": "Column 0 Text",
"display_type": "string"
},
"c1": {
"name": "Column 1 Number",
"display_type": "integer"
},
"c1": {
"name": "Column 2 Number",
"display_type": "integer"
}
}
}
[
{ "c0": "Frank", "c1": 12, "c2": 101 },
{ "c0": "Niels", "c1": 34, "c2": 102 },
{ "c0": "Heye", "c1": 56, "c2": 103 },
{ "c0": "Richard", "c1": 78, "c2": 104 },
]
Minimal Example Request
This returns all rows of the table.
{
"table_id": "6960D3994737607552574B980961708E"
}
{
"row_docs": [
{ "c0": "Frank", "c1": 12, "c2": 101},
{ "c0": "Niels", "c1": 34, "c2": 102},
{ "c0": "Heye", "c1": 56, "c2": 103},
{ "c0": "Richard", "c1": 78, "c2": 104},
]
"total_count": 4
}
Extended Example Request
This retrieves rows from a table with a query and all possible paramters set except skip and limit. A pipeline is not used here, since it would override all other parameters.
{
"table_id": "6960D3994737607552574B980961708E",
"query": {"c1": {"$gt": 10, "$lt": 60}},
"projection": ["c0", "c1"],
"sort_by": "c1",
"sort_dir": -1
}
{
"row_docs": [
{ "c0": "Heye", "c1": 56},
{ "c0": "Niels", "c1": 34}
]
"total_count": 4
}