# Search: paginate content

Paginate content for the whole dataset or for a subset of items when using filters. This endpoint will allow you to sort available content based on a metadata field and get results one page at a time. This is useful when you want to display items on category pages and when visual similarity is not needed because you don't need to compare items.

Another use case for this endpoint is when you want to sort items based on price, updated or created date, size, name or any other string or number metadata available to you and display the top items.

Custom Order Fields

Aside from the metadata fields you associate with your content, Visii provides visii_created_at and visii_updated_at fields automatically that can be used in sorting.

When implementing Analytics API, Visii can also provide advanced sorting fields based on popularity, purchases and other special criteria. Please contact us and tell us about your requirements.

# Input

Endpoint

GET /orgs/:organisation/datasets/:dataset/search

Field Type Required Value Description
organisation String yes The organisation name
dataset String yes The dataset name
page Number no The page number, defaults to 1.
limit Number no The number of items per page. The minimum limit is 2, the maximum limit is 50, the default limit is 10.
sort String no The sorting field, defaults to visii_updated_at. The field type should be a string or a number.
order String no Order results in ascending (asc) or descending (desc) order, defaults to desc.
q String no The filter criteria based on the associated metadata attribute. See Querying for more details.
fields String no A comma separated list of associated item metadata fields to be added to the response (i.e fields=category,colour).
Request all metadata using fields=*. Additional fields generated when processed by Visii include image_width, image_height and image_url.
v String The vars querystring containing key-value pairs (key:value comma separated) of action information, support both specific (such as page_view_id and other custom parameters.
Details of Vars Querystring.
E.g.: v=a:exit,id:abc-123,user_id:abc,page_view_id:12345

# Request

Note

my-dataset-api-token is a dataset token, not an organisation token.

curl -X GET \
     -H "Authorization: token <my-dataset-token>" \
     -H "Accept: application/vnd.visii.v2+json" \
     "https://api.visii.com/orgs/my-org/datasets/my-dataset/search?fields=category,price&q=price:10:&page=1&limit=2&sort=price&order=desc"

# Response

Field Type Value Description
status String The status of the response
results Object The list of results to be shown for this step of the journey
results.$.id String The id of the item
results.$.explore_url String The URL to obtain the next set of results if this item is selected
results.$.metadata Object A selection of metadata fields for the item
total_results Number Total number of results, useful to calculate total number of pages
HTTP/1.1 200 OK
{
  "results": [
    {
      "id": "123",
      "explore_url": "https://api.visii.com/orgs/my-org/datasets/my-dataset/explore?id=123&fields=category,price&q=category:cats&limit=2&j=sid1"
      "metadata": {
        "category": "boots",
        "price": 99.99
      }
    },
    {
      "id": "456",
      "explore_url": "https://api.visii.com/orgs/my-org/datasets/my-dataset/explore?id=456&fields=category,price&q=category:cats&limit=2&j=sid1"
      "metadata": {
        "category": "heels",
        "price": 10.49
      }
    }
  ],
  "total_results": 10,
  "status": "ok"
}
Last Updated: 8/16/2022, 4:45:05 PM