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

List of search terms the logged in member has recently searched for ordered by most recent first.

AutoSuggestions Collection of <AutoSuggestion> or null

List of suggested search terms based on terms popular with Trade Me members ordered by their popularity.

SearchTerm String or null

The search term Trade Me members have been using.

SearchTermCategorySuggestions Collection of <SearchTermCategory> or null

Categories we suggest you search for the search term in. This is only populated if you are searching in all categories.

Id Integer

The ID of the category.

Description String or null

The description for the suggested category.

CategorySuggestions Collection of <CategorySuggestion> or null

List of category suggestions that that are relevant to the given search term.

Id Integer

The ID of the suggested category.

Name String or null

The name of the suggested category.

AncestorsNames Collection of String or null

A list of names of the suggested categories ancestors. Collection is ordered from root to leaf.

StoreSuggestions Collection of <StoreSuggestion> or null

List of store suggestions that are relevant to the given search term.

MemberId Integer

The ID of the suggested store.

StoreName String or null

The name of the suggested store.

StorePath String or null

The path of the suggested store.

Description String or null

The description of the suggested store.

LogoImageUri String or null

The profile logo image URL of the suggested store.

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"
    }
  ]
}