Retrieve a list of products

GET /api/search/products/{searchText}

Success: 200 OK

Overview

Finds products whose code or description contains the text you supply, and returns each with its classification and any translated descriptions. Use it to build a product picker or to resolve a product code a user has typed.

One term is matched as a substring against both the product code and the description, so searching swim returns products coded SWIM01 as well as anything described as "Swimming". The match is case-insensitive and there is no fuzzy matching, so a misspelling returns nothing.

Results are capped at 100 and there is no paging. The cap is applied after sorting by description, so a broad search silently returns the first hundred alphabetically and gives no signal that more exist. Narrow the search rather than trying to page it.

No match returns 200 with an empty array. Every product matching the text is returned regardless of whether it is sellable, on sale at a site, or bookable online — this is a lookup, not an availability check.

Endpoint

GET {base_url}/api/search/products/{searchText}

{base_url} is the environment URL issued to your integration. See Authenticating with Gladstone APIs.

Path parameters

NameTypeRequiredDescription
searchTextstringYesThe text to look for in the product code or description. Trimmed before use; empty or whitespace-only fails with 400 and Search Text cannot be empty, and anything over 255 characters fails with Search Text cannot be more than 255 characters. Matched as a substring anywhere in either field, case-insensitively — there is no way to request an exact or prefix match.

Sample request

cURL
curl -X GET '{base_url}/api/search/products/{searchText}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'

Response fields

FieldTypeDescription
[].idstringThe product code — a short string, not a number, and the value other endpoints take when they ask for a product. It is one of the two fields searchText is matched against.
[].descriptionstringThe product's untranslated description, in the tenant's base language. It is the other field searchText matches on, and the sort key for the result set. Use translations in preference where you have a culture to render for.
[].resourceIndstringWhat kind of thing the product is, as a name rather than a number: StandardProduct for an ordinary sale line, StandardResource or DensityResource for products tied to a bookable resource. A product with no value stored is reported as StandardProduct.
[].typeIndstringHow the product is paid for, as a name rather than a number: Retail for a normal priced item, SmartCardCredit or CashlessCredit for products that top up a stored balance instead of selling goods. A product with no value stored is reported as Retail.
[].translationsarray of objectCulture-specific text for the product. Unlike most configuration endpoints this returns every translated property, not just the description, so inspect type on each entry rather than assuming they are all the same. Returned as an empty array, never null, when the product has no translations.
[].translations[].typestringWhich property of the product this entry translates — description and whatever else the tenant has configured for products. Filter on it before using text, or you risk showing the wrong field.
[].translations[].culturestringThe culture this entry applies to. Match it against the locale you are rendering for and fall back to the untranslated field when there is no entry.
[].translations[].textstringThe translated value of the property named in type, for the culture in culture. It replaces that property for display rather than supplementing it.

Sample response

200 OK
[
  {
    "id": "string",
    "description": "string",
    "resourceInd": "string",
    "typeInd": "string",
    "translations": [
      {
        "type": "string",
        "culture": "string",
        "text": "string"
      }
    ]
  }
]

Errors

StatusMeaningWhen
400Bad requestsearchText is empty or whitespace only — body Search Text cannot be empty — or longer than 255 characters, body Search Text cannot be more than 255 characters. The body is the plain message, not JSON.
500Internal server errorAn unexpected server-side failure during the search, with an empty body.

This page as markdown · All pages · llms.txt