Overview

This describes the resources that make up the official Marketplacer API V2.

Issues

If you encounter any issues with using this API, please report them on our GitHub issues page with:

  1. a curl example of what request you’re making
  2. What headers + body are being returned from the server
  3. What you expect to happen

JSON API

This API complies with the jsonapi.org specification. Please consult its documentation to learn about it if you have not done so already.

Content Type

API clients must supply a Content-Type header of application/vnd.api+json when sending request data:

$ curl -H "Content-Type: application/vnd.api+json" -d "{ ... }" -X POST https://www.bikeexchange.com.au/api/v2/client/adverts

Pagination

Some resources may be paginated. Each paginated collection is limited to 100 resources at a time. A paginated resource will always contain a links key on the top-level which contains first, next and last keys:

{
  "links": {
    "first": "[route]?page[number]=1&page[size]=100",
    "next": "[route]?page[number]=2&page[size]=100",
    "last": "[route]?page[number]=2&page[size]=100"
  }
}

The “first” link returned here is the link to the first page of this reosurce. The “next” link is the next page of this resource, and the “last” link indicates the last page of results that will show results.

For instance, to paginate through the Variants endpoint, you can make requests as so:

  GET https://bikeexchange.com.au/api/v2/client/variants?page[number]=1
  GET https://bikeexchange.com.au/api/v2/client/variants?page[number]=2
  ...
  GET https://bikeexchange.com.au/api/v2/client/variants?page[number]=n

You can also change the number of items returned in one request by using the page[size] parameter. This example will only show 10 items at a time:

  GET https://bikeexchange.com.au/api/v2/client/variants?page[size]=10

Authentication

To authenticate to the API, use an Authorization header:

$ curl -H "Authorization: Bearer api_key" https://www.bikeexchange.com.au/api/v2/client/adverts

If your site is protected by basic authentication, that will conflict with the Bearer method. In that case, send your API key using MARKETPLACER-API-KEY:

$ curl -u username:password -H "MARKETPLACER-API-KEY: api_key" https://www.bikeexchange.com.au/api/v2/client/adverts

Information on how to create your api_key can be found in Getting Started