Add Consumption

Endpoint

  • Method: POST

  • Path: /api/v4/add_consumption

  • Description: Adds 1 or more consumptions to a license (consumption-type licenses only).

Authentication

See License API Authorization.

Required headers

  • Date (string) — RFC7231 GMT date string

  • Authorization (string)

  • Accept: application/json

  • Content-Type: application/json

Request

Body parameters

Required:

  • hardware_id (string)

  • product (string)

One of:

  • license_key (string)

  • username (string)

Optional:

  • license_id (number)

  • consumptions (number) — Defaults to 1. Can be negative if allowed.

  • max_overages (number)

  • allow_overages (boolean)

  • event (array of strings) — consumption_add (default) or offline_floating_consumptions_sync (mutually exclusive)

Examples

Schema

Request Body

chevron-rightRequest schema (TypeScript + JSON Schema)hashtag

TypeScript

JSON Schema

Response Body

chevron-rightResponse schema (TypeScript + JSON Schema)hashtag

TypeScript

JSON Schema

License Authorization Method

There are two types of product licenses based on how the client application authorizes itself to interact with a license:

  • Key-based product licenses: client interactions with the license have to be authorized using a license_key

  • User-based product licenses: the license has a corresponding "license user" instead of a license key. Client interactions with the license have to be authorized using a username

Errors

If an error occurs, the response will have an HTTP status code of 400 or higher, and the response body will contain an error description in the following format:

chevron-rightError schema (TypeScript + JSON Schema)hashtag

TypeScript

JSON Schema

List of exceptions

chevron-rightunknown_product (400)hashtag

Provided product was not found

chevron-rightlicense_not_found (400)hashtag

License with the provided license user not found

chevron-rightlicense_not_active (400)hashtag

The license is not active

chevron-rightlicense_not_enabled (400)hashtag

The license is not enabled

chevron-rightlicense_not_consumption (400)hashtag

The license needs to be of consumption type

chevron-rightlicense_not_enough_consumptions (400)hashtag

Not enough consumptions left

chevron-rightnegative_consumptions_not_allowed (400)hashtag

Negative consumptions not allowed

chevron-rightdevice_not_found (400)hashtag

An active device matching the hardware_id not found

chevron-rightblacklisted (400)hashtag

This device is blacklisted

Last updated

Was this helpful?