Website logo

Search by image

Converts a photo into a search that can be executed to find listings that are similar to the given photo.

URL: https://api.trademe.co.nz/v1/Photos/ImageSearch.{file_format}
HTTP Method: POST
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.

POST Data

<ImageSearchRequest>

PhotoData String (required)

The actual image data which is base64 encoded.

PreviousVersion Boolean (optional)

Indicates whether to use the previous version of image search (for comparative purposes). If this is specified, it overrides the server's preference.

Returns

<ImageSearchResponse>

SearchApi Enumeration

The search API endpoint that should be used in conjunction with the SearchString property to build up a search URL.

General 0

General search.

UsedMotors 1

Used cars.

MotorBoat 2

Motor boats.

MotorBike 3

Motor bikes.

Residential 4

Residential property for sale.

Rental 5

Residential property to rent.

CommercialSale 6

Commercial property for sale.

CommercialLease 7

Commercial property leases.

Rural 8

Rural property.

Lifestyle 9

Lifestyle blocks.

Flatmate 10

Flatmates.

OpenHomes 11

Open homes.

Retirement 12

Retirement villages.

Job 13

Jobs.

NewHomes 14

New Homes property.

Caravan 15

Motors caravan property

Motorhome 16

Motors motorhomes property

SearchString String or null

A string containing the search parameters. This is formatted like a HTTP query string (but without a leading question mark) and can include any of the parameters accepted by the search APIs.

Example XML Request (switch to JSON)

<ImageSearchRequest xmlns="http://api.trademe.co.nz/v1">
  <PhotoData>ABC</PhotoData>
  <PreviousVersion>false</PreviousVersion>
</ImageSearchRequest>

Example JSON Request (switch to XML)

{
  "PhotoData": "ABC",
  "PreviousVersion": false
}

Example XML Response (switch to JSON)

<ImageSearchResponse xmlns="http://api.trademe.co.nz/v1">
  <SearchApi>General</SearchApi>
  <SearchString>ABC</SearchString>
</ImageSearchResponse>

Example JSON Response (switch to XML)

{
  "SearchApi": 0,
  "SearchString": "ABC"
}