Website logo

Retrieve attributes for a category

Retrieves the list of attributes which are applicable to a specific category.

Some categories are currently unsupported (including subcategories): 350 (Real Estate), 5000 (Jobs) and 36 (Businesses for sale).

This API is deprecated in favour of the category details API.

URL: https://api.trademe.co.nz/v1/Categories/{category}/Attributes.{file_format}
HTTP Method: GET
Requires Authentication? No
Permission Required: Public
Supported Formats: XML, JSON
Rate Limited? No

URL parameters

category String (required)

The category number for which you wish to see the attributes for. This must be a leaf category (for example, you cannot view the attributes for Computers > Desktops, but you can for Computers > Desktops > CRT monitors).

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

Returns

Collection of <Attribute>

Name String or null

A name which uniquely identifies the attribute. Required when selling or editing.

DisplayName String or null

The name of the attribute, in a form suitable for displaying to users. Not required when selling or editing.

Type Enumeration

The type of the attribute, which determines the range of acceptable values. Not required when selling or editing.

None 0

Not used.

Boolean 1

The attribute value is a boolean (true/false).

Integer 2

The attribute value is an integer.

Decimal 3

The attribute value is a floating point number.

String 4

The attribute value can be arbitrary text.

DateTime 5

The attribute value is a date & time (in UTC).

Range <AttributeRange> or null

The allowed range of the attribute. Only applies to numeric attributes. Not required when selling or editing.

Lower String or null

The lowest allowed value of the attribute.

Upper String or null

The highest allowed value of the attribute.

MaxStringLength Integer

The maximum allowed length of the attribute value, in characters. Only applies to string attributes. Some string attributes do not have a maximum length because they are restricted to a fixed list of options, or because any length is acceptable. Not required when selling or editing.

Options Collection of <AttributeOption> or null

A list of options, if the attribute is restricted to a fixed set of values. Not required when selling or editing.

Value String or null

The value of the item as a string.

Display String or null

What should be displayed for this value (often the same).

Units Collection of <AttributeUnit> or null

A list of units that apply (MHz, hectares, etc). Only applies to numeric attributes. Not required when selling or editing.

Display String or null

The unit name, in a format suitable for displaying to a user (e.g. "MHz").

Multiplier Number

The multiplier to apply to the value the user entered to get a value suitable for passing to the sell API.

IsRequiredForSell Boolean

Indicates whether the attribute must be present when selling an item.

GroupName String or null

Suggests the category name for the attribute grouping on the UI level.

Examples

https://api.trademe.co.nz/v1/Categories/9374-9375-9377-/Attributes.xml - Retrieves attribute information for the International Accommodation category.

Example XML Response (switch to JSON)

<Attributes xmlns="http://api.trademe.co.nz/v1">
  <Attribute>
    <Name>ABC</Name>
    <DisplayName>ABC</DisplayName>
    <Type>None</Type>
    <Range>
      <Lower>ABC</Lower>
      <Upper>ABC</Upper>
    </Range>
    <MaxStringLength>123</MaxStringLength>
    <Options>
      <AttributeOption>
        <Value>ABC</Value>
        <Display>ABC</Display>
      </AttributeOption>
      <AttributeOption>
        <Value>ABC</Value>
        <Display>ABC</Display>
      </AttributeOption>
    </Options>
    <Units>
      <AttributeUnit>
        <Display>ABC</Display>
        <Multiplier>123.0</Multiplier>
      </AttributeUnit>
      <AttributeUnit>
        <Display>ABC</Display>
        <Multiplier>123.0</Multiplier>
      </AttributeUnit>
    </Units>
    <IsRequiredForSell>false</IsRequiredForSell>
    <GroupName>ABC</GroupName>
  </Attribute>
  <Attribute>
    <Name>ABC</Name>
    <DisplayName>ABC</DisplayName>
    <Type>None</Type>
    <Range>
      <Lower>ABC</Lower>
      <Upper>ABC</Upper>
    </Range>
    <MaxStringLength>123</MaxStringLength>
    <Options>
      <AttributeOption>
        <Value>ABC</Value>
        <Display>ABC</Display>
      </AttributeOption>
      <AttributeOption>
        <Value>ABC</Value>
        <Display>ABC</Display>
      </AttributeOption>
    </Options>
    <Units>
      <AttributeUnit>
        <Display>ABC</Display>
        <Multiplier>123.0</Multiplier>
      </AttributeUnit>
      <AttributeUnit>
        <Display>ABC</Display>
        <Multiplier>123.0</Multiplier>
      </AttributeUnit>
    </Units>
    <IsRequiredForSell>false</IsRequiredForSell>
    <GroupName>ABC</GroupName>
  </Attribute>
</Attributes>

Example JSON Response (switch to XML)

[
  {
    "Name": "ABC",
    "DisplayName": "ABC",
    "Type": 0,
    "Range": {
      "Lower": "ABC",
      "Upper": "ABC"
    },
    "MaxStringLength": 123,
    "Options": [
      {
        "Value": "ABC",
        "Display": "ABC"
      },
      {
        "Value": "ABC",
        "Display": "ABC"
      }
    ],
    "Units": [
      {
        "Display": "ABC",
        "Multiplier": 123.0
      },
      {
        "Display": "ABC",
        "Multiplier": 123.0
      }
    ],
    "IsRequiredForSell": false,
    "GroupName": "ABC"
  },
  {
    "Name": "ABC",
    "DisplayName": "ABC",
    "Type": 0,
    "Range": {
      "Lower": "ABC",
      "Upper": "ABC"
    },
    "MaxStringLength": 123,
    "Options": [
      {
        "Value": "ABC",
        "Display": "ABC"
      },
      {
        "Value": "ABC",
        "Display": "ABC"
      }
    ],
    "Units": [
      {
        "Display": "ABC",
        "Multiplier": 123.0
      },
      {
        "Display": "ABC",
        "Multiplier": 123.0
      }
    ],
    "IsRequiredForSell": false,
    "GroupName": "ABC"
  }
]