All Versions

Version 1
Version 2


Page tree

Supplier API v2

Skip to end of metadata
Go to start of metadata

Table of Contents

Overview

This section lists the data formats supported by this API for request and response bodies. The applicable MIME type is also listed for your convenience.

JSON is currently the only data format supported by this API.

Supported Data Formats

Data FormatMIME type
JSONapplication/json

Specifying the Data Format for Response Data

The Accept header specifies the MIME type for the format in which you would like the API to return data to you. You may specify the Accept header using any valid syntax, including a combination of multiple MIME types with wildcards and quality values. The following examples are all considered to be valid and accepted by this API.

Accept: application/json
Accept: */*
Accept: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8

If you do not specify the Accept header then API will assume application/json as the value.

The response will always contain a Content-Type header specifying the data type of the resource being returned.

Related Errors

If you specify an Accept header that does not allow one of the Supported Data Formats as one of the specified MIME types, the API will respond with an HTTP Status of 406: Not Acceptable. In this case, the API must assume that the caller will not understand any supported data formats. So, the error response will have no content.

HTTP StatusError CodeDescription
406: Not Acceptableerror-codeNo supported data type was allowed in the Accept header of the request.

Example: Proper Use of the Accept Header

This example sets the Accept header in its simplest form to allow all data formats as a response from the API.

The Content-Type header in the response indicates that the API has provided JSON data.

GET /api/v2/members/M0001
Accept: */*
Accept-Version: 1.0
Authorization: Basic Y3JpdGljYWxtaXg6dG9wc2VjcmV0

HTTP/1.1 200
Content-Type: application/json; charset=utf-8
Content-Version: 1.0
{
  "memberId": "M0001", 
  "language": "EN", 
  "email": "m0001@example.com",
  "firstName": "John",
  "lastName": "Snow",
  "birthDate": "1984/01/20",
  "address": { 
    "country": "US",
    "streetAddress": null,
    "postalcode": "10101"
  } 
}


Example: Content-Type Does Not Allow Any Supported Data Formats

This example shows a request for XML data from the API. Since the API does not support XML, and since the Content-Type header does not provide any other alternatives, the API responds with an error.

Also, since the API must assume that the caller only wants XML in the response, the standard JSON formatted error message is not returned.

GET /api/v2/members/M0001
Accept: application/xml
Accept-Version: 1.0
Authorization: Basic Y3JpdGljYWxtaXg6dG9wc2VjcmV0

HTTP/1.1 406


Lists the data formats supported by the API and explains how to specify a data format in your requests

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.