Website logo

Get search suggestions

Returns up to three collections of search suggestions all based on the passed in search term: Autosuggestions - suggestions based on similar search terms popular with the Trade Me community Recent searches - suggestions based on previous searches the logged in member has performed Category suggestions - suggestions based on categories similar to the passed in search term.

URL: https://api.trademe.co.nz/v1/Search/Suggestions.{file_format}
HTTP Method: GET
Requires Authentication? Yes
Permission Required: None
Supported Formats: XML, JSON
Rate Limited? Yes

URL parameters

file_format Enumeration (required) The format of the response.
xml Serialize responses into XML.
json Serialize responses into JSON.

Query String parameters

category_id Integer (optional)

The identifier of the category to be used when generating suggestions, use 0 for all categories. Defaults to 0.

max_auto_suggestions Integer (optional)

The maximum number of autosuggest suggestions to be returned. Defaults to 12.

max_category_suggestions Integer (optional)

The maximum number of category suggestions to be returned. Defaults to 12.

max_recent_searches Integer (optional)

The maximum number of recent searches to be returned. Defaults to 12.

max_total_suggestions Integer (optional)

The maximum number of suggestions of all types to be returned. Defaults to 12.

search_string String (optional)

The partial keyword that the suggestions will be based on.

Returns

<SearchSuggestions>

RecentSearches Collection of String or null RecentSearches
AutoSuggestions Collection of <AutoSuggestion> or null AutoSuggestions
SearchTerm String or null SearchTerm
SearchTermCategorySuggestions Collection of <SearchTermCategory> or null SearchTermCategorySuggestions
Id Integer Id
Description String or null Description
CategorySuggestions Collection of <CategorySuggestion> or null CategorySuggestions
Id Integer Id
Name String or null Name
AncestorsNames Collection of String or null AncestorsNames
StoreSuggestions Collection of <StoreSuggestion> or null StoreSuggestions
MemberId Integer MemberId
StoreName String or null StoreName
StorePath String or null StorePath
Description String or null Description
LogoImageUri String or null LogoImageUri

Example XML Response (switch to JSON)

<SearchSuggestions xmlns="http://api.trademe.co.nz/v1">
  <RecentSearches>
    <RecentSearch>ABC</RecentSearch>
    <RecentSearch>ABC</RecentSearch>
  </RecentSearches>
  <AutoSuggestions>
    <AutoSuggestion>
      <SearchTerm>ABC</SearchTerm>
      <SearchTermCategorySuggestions>
        <SearchTermCategory>
          <Id>123</Id>
          <Description>ABC</Description>
        </SearchTermCategory>
        <SearchTermCategory>
          <Id>123</Id>
          <Description>ABC</Description>
        </SearchTermCategory>
      </SearchTermCategorySuggestions>
    </AutoSuggestion>
    <AutoSuggestion>
      <SearchTerm>ABC</SearchTerm>
      <SearchTermCategorySuggestions>
        <SearchTermCategory>
          <Id>123</Id>
          <Description>ABC</Description>
        </SearchTermCategory>
        <SearchTermCategory>
          <Id>123</Id>
          <Description>ABC</Description>
        </SearchTermCategory>
      </SearchTermCategorySuggestions>
    </AutoSuggestion>
  </AutoSuggestions>
  <CategorySuggestions>
    <CategorySuggestion>
      <Id>123</Id>
      <Name>ABC</Name>
      <AncestorsNames>
        <AncestorsName>ABC</AncestorsName>
        <AncestorsName>ABC</AncestorsName>
      </AncestorsNames>
    </CategorySuggestion>
    <CategorySuggestion>
      <Id>123</Id>
      <Name>ABC</Name>
      <AncestorsNames>
        <AncestorsName>ABC</AncestorsName>
        <AncestorsName>ABC</AncestorsName>
      </AncestorsNames>
    </CategorySuggestion>
  </CategorySuggestions>
  <StoreSuggestions>
    <StoreSuggestion>
      <MemberId>123</MemberId>
      <StoreName>ABC</StoreName>
      <StorePath>ABC</StorePath>
      <Description>ABC</Description>
      <LogoImageUri>ABC</LogoImageUri>
    </StoreSuggestion>
    <StoreSuggestion>
      <MemberId>123</MemberId>
      <StoreName>ABC</StoreName>
      <StorePath>ABC</StorePath>
      <Description>ABC</Description>
      <LogoImageUri>ABC</LogoImageUri>
    </StoreSuggestion>
  </StoreSuggestions>
</SearchSuggestions>

Example JSON Response (switch to XML)

{
  "RecentSearches": [
    "ABC",
    "ABC"
  ],
  "AutoSuggestions": [
    {
      "SearchTerm": "ABC",
      "SearchTermCategorySuggestions": [
        {
          "Id": 123,
          "Description": "ABC"
        },
        {
          "Id": 123,
          "Description": "ABC"
        }
      ]
    },
    {
      "SearchTerm": "ABC",
      "SearchTermCategorySuggestions": [
        {
          "Id": 123,
          "Description": "ABC"
        },
        {
          "Id": 123,
          "Description": "ABC"
        }
      ]
    }
  ],
  "CategorySuggestions": [
    {
      "Id": 123,
      "Name": "ABC",
      "AncestorsNames": [
        "ABC",
        "ABC"
      ]
    },
    {
      "Id": 123,
      "Name": "ABC",
      "AncestorsNames": [
        "ABC",
        "ABC"
      ]
    }
  ],
  "StoreSuggestions": [
    {
      "MemberId": 123,
      "StoreName": "ABC",
      "StorePath": "ABC",
      "Description": "ABC",
      "LogoImageUri": "ABC"
    },
    {
      "MemberId": 123,
      "StoreName": "ABC",
      "StorePath": "ABC",
      "Description": "ABC",
      "LogoImageUri": "ABC"
    }
  ]
}