API Updates - Version 2.1

Contents

Was this article helpful?

Yes No

Overview

Version 2.1 introduces minor changes to authorisation and response data formats. All other functionality remains the same as documented in API V2.

To use V2.1 in any of the API endpoints listed in Config V2 and Reports V2, simply replace v2 in the URL path with v2.1.

For example:

HTTP / Text
https://api.infinitycloud.com/reports/v2/igrps/

Becomes:

HTTP / Text
https://api.infinitycloud.com/reports/v2.1/igrps/

Authorisation

V2.1 requires the use of API Keys to authenticate, rather than using your standard Infinity Hub credentials.

To create an API key for your user, please follow this guide.

  • If an API key is not provided, you will get a 401 “auth required” response code.
  • If the user associated with the API key provided is not allowed to perform the requested action, you will get a 403 “access denied” response code.

When making a request to Infinity APIs, the Authorization header should have the value ApiKey xxx, where xxx is the key generated.

For example, if using cURL, you would send a request in the following format:

HTTP / Text
curl -H 'Authorization: ApiKey xxx' "https://api.infinitycloud.com/config/v2.1/..."

Content Type

In API V2, the response format can be influenced by the format query parameter (see output format).

However, the actual Content-Type header in the response will still be one of:

HTTP / Text
text/plain;charset=UTF-8
text/html;charset=UTF-8
text/xml;charset=UTF-8

This has been problematic for some integration partners. In V2.1, you can use the Accept header to define the response format, and the API will return a matching Content-Type in the response.

The supported values are:

Accept Header Notes
application/json Returns a JSON array
application/stream+json May return a single JSON object (streamed)
application/xml  
text/xml  
application/xhtml+xml Requires display parameter
text/csv Requires display parameter

See: Display parameter usage.

0333 0600 118