The Data Stream can be sorted by any column in ascending or descending order. Sorting by multiple columns at once is also possible.
GET
https://api.fusionbase.com/api/v2/stream/data/{STREAM_ID}?query_parameters={"sort_order": ["asc"], "sort_keys": ["fb_datetime"]}&format=json
The Data Stream can be sorted by any column in ascending or descending order. Sorting by multiple columns at once is also possible.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
This is a sample response for a specific stream:
The Fusionbase API allows users to sort data within a stream using the query_parameters
parameter in the request. This feature enables efficient organization and retrieval of data based on specific sorting criteria.
To sort data in a stream, include the query_parameters
parameter in your GET request to /api/v2/stream/data/{STREAM_ID}
. This parameter accepts JSON-formatted sorting instructions.
The query_parameters
JSON object can contain the following properties related to sorting:
sort_keys
: A list of column names by which the data should be sorted. These keys should correspond to columns in the data stream.
sort_order
: Specifies the sorting order for each key in sort_keys
. The available options are "asc"
for ascending order and "desc"
for descending order.
You can specify multiple sort keys in the sort_keys
list. The data will be sorted based on the order of keys provided. The corresponding sort_order
list should match the length of sort_keys
to specify the sorting order for each key.
Consider a data stream with columns such as fb_datetime
, price
, and product_name
. To sort the data first by fb_datetime
in ascending order and then by price
in descending order, structure your request as follows:
The sorting functionality is dependent on the structure of the data stream.
Ensure that the column names used in sort_keys
are valid and present in the data stream.
The order of elements in sort_keys
and sort_order
is significant and should correspond to each other.
If invalid column names are used or if there's a mismatch in the length of sort_keys
and sort_order
, the API might return an error response.
STREAM_ID
String
The ID of the Data Stream
query_parameters
Object
URI encoded JSON string
format
String
json or msgpack