Search
New standard of Core API supports search endpoints for various top level business entities. For example, you can search customers, search employees and search orders. An arbitrary query parameter called query will be available to allow for search on various entity fields. There are two types of search offered through API endpoints: Advanced Search and Basic Search. Advanced Search supports more complex search queries allowing you to search on multiple fields, nested fields and offers wild card support. With Basic Search you are able to search on specific data fields such as store.name.
Advanced Search Request Format
query (Required) - This is the search query string. Reference Search Query Language section for syntax and semantic logic.
Example search request:
/crm/customers/search?query=firstName:Bob
Advanced Search Query Language Syntax
All search endpoints follow the Search Query Language syntax.
The query clause consists of a field , an operator and it’s value:
?query=firstName:Bob
field (All supported fields available for search will be denoted in the endpoint API reference):
firstNameoperators:
:value:
Bob
Wild Card Support
Generic keyword with wildcard support: ?query=Bob*
Searching on multiple fields (AND)
Ability get granular with search: query=firstName:Bob;email:bob@example.com , delimited by ;.
Searching on nested fields
Attributes in objects should be filterable using the syntax attribute.attr_name : attribute.allow_email:true
Complex Queries using AND and OR
By default all of the clauses are AND together. To define an OR query, you can provide the | character between both sides of the OR in the clause.
Examples
Search for all customers with: firstName = Bob OR lastName = Danger
?query=firstName:Bob|lastName:Danger;
Search for all customers with: firstName = Bob OR firstName = Doug AND orderTotal = 1000
?query=firstName:bob|firstName:doug;orderTotal:1000
Basic Search Format
The query clause consists of providing a query parameter a value to search on:
?query="ABC_store_name"
Search Response Format
The search response format is the standard list response format that you will see with any search endpoint (advanced or basic) that returns a list of resources:
{
"resources": [
{...}
],
"errors": [
{...}
],
"totalRecords": 0,
"hasMore": true,
"nextPageURL": "string"
}
Refer to Pagination and Sorting document for more on how to access multiple results through hasMore and nextPageURL and sort search results using sort and sort_direction parameters.