API to Retrieve the Results

After creating the query and obtaining its ID, you can check its status, obtain details about the query, and retrieve results:
  • GET <baseurl>/api/v2/query/{id}/status
  • GET <baseurl>/api/v2/query/{id}/details
  • GET <baseurl>/api/v2/query/{id}/results

The API to retrieve results takes the following parameters:

  • id: The id of the query to get results from
  • offset (optional): The offset of the results to be retrieved. Only available for cached queries. For non-cached queries, you cannot choose the offset; the results must be retrieved sequentially using multiple calls to this API.
  • size (optional): The number of rows to return in this call. The API might return fewer or no rows, depending on the number of rows available.
  • longPollTimoeut (optional): The time in milliseconds to wait before returning results, if the result rows are not available. Only available for non-cached queries.

This API returns:

  • rows: The array of rows. In most cases, it is a subset of the result rows. However, it could be all the results if there are only a few. Whether you need to fetch more results or not is indicated by the hasMore parameter. To fetch more rows, you must call this method again.
  • offset: The offset of the subset of the rows returned.
  • errorsOrWarnings: The details of error or warnings, if any.
  • hasMore: A boolean value. It is true if more rows are available to fetch, and false if there are no more rows to fetch.

Typically this API is repeatedly invoked to fetch the rows, until hasMore is false. After all the results have been fetched, you can delete the query.