Catalog search is used to find items in the API POS system by passing a structured query into it, letting the system process the query, and then pulling the results when they are ready.
The structure was designed to work asynchronously to help manage system load, and be able to provide results faster via caching and other methods. To use the search, you will initially hit an endpoint (POST) to build the request and receive a token, that you then use to hit another endpoint (GET) to retrieve the result set.
For example, to use the POST Sales/{subscriberId}/Catalog/Search, you would build out the request and pass it to the endpoint. The method takes the request, puts it in the queue to be executed, and returns a response with a token to be able to retrieve the results when they are available.
Once the request is executed the results will be available to be accessed by passing the token into the GET Sales/{subscriberId}/Catalog/Search/{itemsRequestId} in the {itemsRequestId} parameter.
Check out event sourcing and cqrs to learn more about these topics.
Any masking, user permissions, or other restrictions based on the user context (client, staff, owner, etc.) will be taken into account when the results are ready. For example, if a staff user is requesting a list of items but they do not have the permission to view gift cards, any gift card items will be removed from the results.
This section describes how to do a catalog search for items. If you'd like to search for series that can pay for Appointments, Classes, or Enrollments, please see Catalog Search for Series.
Catalog searching was built off of the OData query model for building a request to retrieve results. This model includes any filtering, ordering, and result count (pagination) required for the consumer. That is, you pass all the filtering, ordering, and result counts you want to receive to the endpoint.
To specify the type of items you want to search for, specify ItemType in the OData filter
?$filter=ItemType eq 'GiftCard'
?$filter=ItemType eq 'GiftCard'&$orderby=ItemId&$top=10&$skip=20
Special characters need to be encoded when using an OData request.
For example, if you are searching for an item with a name of "Yoga Mat - Blue & Gold",
you would need to encode the "&" as "%26" making your filter look like: "Name eq 'Yoga Mat - Blue %26 Gold'".
See MSDN's Special Characters page for more information.
Example for search.
{"ItemsRequestId": “12ab3c45-d6e7-8f9g-01h2-3i4k5lmn6789", "ExpiresIn": 900}
{ "Items": [ { "PurchaseItem": { "Links": [], "Templates": [ { "Id": null, "Name": "Purchasable", "TemplateType": "Purchasable", "Metadata": [ { "Key": "Online", "Value": "50.0000", "Type": "Decimal", "Label": "Online", "Rules": [ { "Rule": "Required", "Value": "False" }, { "Rule": "Editable", "Value": "False" } ] } ] }, { "Id": null, "Name": "GiftCard", "TemplateType": "GiftCard", "Metadata": [ { "Key": "Credit", "Value": "50.0000", "Type": "Decimal", "Label": "Credit Amount", "Rules": [ { "Rule": "Required", "Value": "True" }, { "Rule": "Editable", "Value": "False" } ] } ] }, { "Id": null, "Name": "GiftCardLayout", "TemplateType": "GiftCardLayout", "Metadata": [ { "Key": "GiftCardMessage", "Value": null, "Type": "String", "Label": "Custom Message", "Rules": [ { "Rule": "Required", "Value": "False" } ] }, { "Key": "RecipientName", "Value": null, "Type": "String", "Label": "Recipient Nickname", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "RecipientFulLname", "Value": null, "Type": "String", "Label": "Receipient's Full Name", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "RecipientEmail", "Value": null, "Type": "String", "Label": "Recipient's Email", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "SenderName", "Value": null, "Type": "String", "Label": "Sender's Name", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "DeliveryDate", "Value": "", "Type": "DateTime", "Label": "Gift Card Delivery Date", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "Title", "Value": null, "Type": "String", "Label": "Gift Card Title", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "Terms", "Value": null, "Type": "String", "Label": "Gift Card Terms", "Rules": [ { "Rule": "Required", "Value": "False" } ] }, { "Key": "GiftCardLayoutId", "Value": "", "Type": "option:GiftCardLayoutId", "Label": "GiftCardLayoutId", "Rules": [ { "Rule": "Required", "Value": "True" } ] } ] } ], "Options": [ { "MetadataType": "GiftCardLayoutId", "Values": null, "Items": [ { "Name": "Green with Yellow Flowers", "Value": "1", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/1.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards//studios/TrevorDevDemo2/giftcards/1.png", "ImageUrlSmall": "1.png" } }, { "Name": "Zen Reeds", "Value": "2", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/2.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/2.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/2.png" } }, { "Name": "Blank", "Value": "3", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/3.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/3.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/3.png" } }, { "Name": "Anniversary", "Value": "4", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/4.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/4.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/4.png" } }, { "Name": "Balloons", "Value": "5", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/5.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/5.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/5.png" } }, { "Name": "Birthday", "Value": "6", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/6.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/6.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/6.png" } }, { "Name": "Free Weight", "Value": "7", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/7.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/7.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/7.png" } }, { "Name": "Flowers", "Value": "8", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/8.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/8.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/8.png" } }, { "Name": "Happy Holidays", "Value": "9", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/9.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/9.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/9.png" } }, { "Name": "Floral Flourish", "Value": "10", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/10.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/10.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/10.png" } }, { "Name": "Snowflakes", "Value": "11", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/11.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/11.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/11.png" } }, { "Name": "Pink Flourish", "Value": "12", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/12.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/12.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/12.png" } }, { "Name": "King Dancer", "Value": "13", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/13.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/13.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/13.png" } }, { "Name": "Custom", "Value": "109", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/109.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/109.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/109.png" } }, { "Name": "Custom", "Value": "112", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/112.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/112.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/112.png" } }, { "Name": "Custom", "Value": "113", "Properties": { "ImageUrl": "/studios/TrevorDevDemo2/giftcards/113.png", "ImageUrlMedium": "/studios/TrevorDevDemo2/giftcards/113.png", "ImageUrlSmall": "/studios/TrevorDevDemo2/giftcards/113.png" } } ] } ], "Rules": [ { "Rule": "LocationRestrictions", "Key": "LocationId", "Operation": "Not Contains", "Values": [ "98" ] } ], "Id": "140", "Name": "Prepaid $50 no edit", "Description": null, "Image": null, "Type": "GiftCard", "ValueBuckets": null } }, { "PurchaseItem": { "Links": [], "Templates": [ { "Id": null, "Name": "Purchasable", "TemplateType": "Purchasable", "Metadata": [ { "Key": "Online", "Value": "75.0000", "Type": "Decimal", "Label": "Online", "Rules": [ { "Rule": "Required", "Value": "False" }, { "Rule": "Editable", "Value": "False" } ] } ] }, { "Id": null, "Name": "GiftCard", "TemplateType": "GiftCard", "Metadata": [ { "Key": "Credit", "Value": "75.0000", "Type": "Decimal", "Label": "Credit Amount", "Rules": [ { "Rule": "Required", "Value": "True" }, { "Rule": "Editable", "Value": "False" } ] } ] }, { "Id": null, "Name": "GiftCardLayout", "TemplateType": "GiftCardLayout", "Metadata": [ { "Key": "GiftCardMessage", "Value": null, "Type": "String", "Label": "Custom Message", "Rules": [ { "Rule": "Required", "Value": "False" } ] }, { "Key": "RecipientName", "Value": null, "Type": "String", "Label": "Recipient Nickname", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "RecipientFulLname", "Value": null, "Type": "String", "Label": "Receipient's Full Name", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "RecipientEmail", "Value": null, "Type": "String", "Label": "Recipient's Email", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "SenderName", "Value": null, "Type": "String", "Label": "Sender's Name", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "DeliveryDate", "Value": "", "Type": "DateTime", "Label": "Gift Card Delivery Date", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "Title", "Value": null, "Type": "String", "Label": "Gift Card Title", "Rules": [ { "Rule": "Required", "Value": "True" } ] }, { "Key": "Terms", "Value": null, "Type": "String", "Label": "Gift Card Terms", "Rules": [ { "Rule": "Required", "Value": "False" } ] }, { "Key": "GiftCardLayoutId", "Value": "", "Type": "option:GiftCardLayoutId", "Label": "GiftCardLayoutId", "Rules": [ { "Rule": "Required", "Value": "True" } ] } ] } ], "Options": [ { "MetadataType": "GiftCardLayoutId", "Values": null, "Items": [ { "Name": "Green with Yellow Flowers", "Value": "1", "Properties": { "ImageUrl": "1.png", "ImageUrlMedium": "1.png", "ImageUrlSmall": "1.png" } }, { "Name": "Zen Reeds", "Value": "2", "Properties": { "ImageUrl": "2.png", "ImageUrlMedium": "2.png", "ImageUrlSmall": "2.png" } }, { "Name": "Blank", "Value": "3", "Properties": { "ImageUrl": "3.png", "ImageUrlMedium": "3.png", "ImageUrlSmall": "3.png" } }, { "Name": "Anniversary", "Value": "4", "Properties": { "ImageUrl": "4.png", "ImageUrlMedium": "4.png", "ImageUrlSmall": "4.png" } }, { "Name": "Balloons", "Value": "5", "Properties": { "ImageUrl": "5.png", "ImageUrlMedium": "5.png", "ImageUrlSmall": "5.png" } }, { "Name": "Birthday", "Value": "6", "Properties": { "ImageUrl": "6.png", "ImageUrlMedium": "6.png", "ImageUrlSmall": "6.png" } }, { "Name": "Free Weight", "Value": "7", "Properties": { "ImageUrl": "7.png", "ImageUrlMedium": "7.png", "ImageUrlSmall": "7.png" } }, { "Name": "Flowers", "Value": "8", "Properties": { "ImageUrl": "8.png", "ImageUrlMedium": "8.png", "ImageUrlSmall": "8.png" } }, { "Name": "Happy Holidays", "Value": "9", "Properties": { "ImageUrl": "9.png", "ImageUrlMedium": "9.png", "ImageUrlSmall": "9.png" } }, { "Name": "Floral Flourish", "Value": "10", "Properties": { "ImageUrl": "10.png", "ImageUrlMedium": "10.png", "ImageUrlSmall": "10.png" } }, { "Name": "Snowflakes", "Value": "11", "Properties": { "ImageUrl": "11.png", "ImageUrlMedium": "11.png", "ImageUrlSmall": "11.png" } }, { "Name": "Pink Flourish", "Value": "12", "Properties": { "ImageUrl": "12.png", "ImageUrlMedium": "12.png", "ImageUrlSmall": "12.png" } }, { "Name": "King Dancer", "Value": "13", "Properties": { "ImageUrl": "13.png", "ImageUrlMedium": "13.png", "ImageUrlSmall": "13.png" } }, { "Name": "Custom", "Value": "109", "Properties": { "ImageUrl": "109.png", "ImageUrlMedium": "109.png", "ImageUrlSmall": "109.png" } }, { "Name": "Custom", "Value": "112", "Properties": { "ImageUrl": "112.png", "ImageUrlMedium": "112.png", "ImageUrlSmall": "112.png" } }, { "Name": "Custom", "Value": "113", "Properties": { "ImageUrl": "113.png", "ImageUrlMedium": "113.png", "ImageUrlSmall": "113.png" } } ] } ], "Rules": [ { "Rule": "LocationRestrictions", "Key": "LocationId", "Operation": "Not Contains", "Values": [ "98" ] } ], "Id": "141", "Name": "Prepaid $75 no edit", "Description": null, "Image": null, "Type": "GiftCard", "ValueBuckets": null } } } ], "NextPageLink": null, "Count": 6 }
The CatalogItem is the item information provided from the Catalog Search request.
It is intended to include all details necessary to implement a UI simply based on the details of the item.
The details include, but are not limited to:
See the CatalogItem object specification for more details.
OData is a standardized way to provide CRUD operations to .NET-based APIs, and is how our system pulls the correct data from data storage based on the API request.
The requests are based on OData URI Conventions.
For example:
?$filter=ItemType eq 'GiftCard'&$orderby=ItemId&$top=10&$skip=20
This is telling the request to only show results with an ItemType of "GiftCard", to order the results by the ItemId, to skip the first 20 results, and pull the next 10 (results 20 through 30).