Search

Speed has set a standardization for SQL so you can make a query and get faster results. If you do not want to paginate through all the objects of a particular resource to find your match, Search APIs are the best way to go.

Right now, Search API is available for below mentioned resources:

For you to use search via APIs on these mentioned resources, you need to understand how to make a query clause that will fetch you a result. This query is a clause made up of fields, values, and an operator between them.

Additionally, a query can have multiple clauses in it. See more about this here.

Let’s see the structure and syntax to formulate a proper query.

Query structure

A query clause consists of a field followed by an operator followed by a value.

fieldemailFields are what content you are searching for from the object, like email, date, metadata, etc.
operator:Operators are used for searching the matching value of an object. Operators are greater than (>), less than (<), equals to (=), and many others.
valuemailto: [email protected]It is the value of the field for which you want the match. Like mailto:[email protected], 12/09/2022, etc.

All of this formulates a query clause. Example: email:"[email protected]".You must use quotation marks around string values. Quotation marks are optional for numeric values.

Concatenating multiple clauses

You can combine multiple clauses in a search query by either separating them with a space or using the AND. By default, the API combines clauses with AND logic.

Example: amount>120 status:paid metadata[‘key_1’]:value_1

The purpose of search APIs is to provide data on search queries. For example, you can search payments, checkout links, and payment links. You can use the search APIs to flexibly retrieve your Speed objects. Search is a faster alternative to paginating through all resources. Review the search query language to know more.

Speed's search API methods utilize cursor-based pagination via the page request parameter and nextpage response parameter. For example, if you make a search request and receive next_page: **_pagination_key in the response, your subsequent call can include page=pagination_key** to fetch the next page of results.

Search request format


{
    "query":"amount<100",
    "limit":7,
    "page" : "63b2a79356c0e4ca36733212"
}

query string

The query clause according to Speed's query language. Make sure to check the list of query fields supported for the respective modules here.


limit integer

A limit specifies the number of objects to be returned. The default page size has 10 objects per page, and it is consistent across endpoints.


page integer

A cursor to scroll through the results pages. Enter the next_page value returned in a previous response in this parameter to request subsequent results. The first API call does not need this parameter.


Response

{
  "has_more": true,
  "object": "search_payment",
  "data": [],
  "next_page": null,
  "total_count": 2
}

Attributes


has_more boolean

Whether or not there are more elements available after this set of records. If false, this set comprises the end of the list.


object string

The type of the object indicates to which entity this data array belongs.


data string

An array containing the actual record elements, paginated by request parameters.


next_page string

A cursor to scroll through the results pages. If has_more is true, you can pass the value of next_page to a subsequent call to fetch the next page of results.


total_count string

The total number of objects that match the query, only accurate up to 10,000.