Use the API to set a Prorated Brick

The setGauge mutation is designed to increment the prorated gauge for a specific customer in Salesbricks. To utilize this mutation, follow the authentication steps outlined in the Authentication guide, and ensure that you are using the Usage API Endpoint.

Schema

type SetGaugeResponse {
  success: Boolean!
}

type Mutation {
  setGauge(
    timestamp: DateTime!
    subscriptionId: String!
    brickId: String!
    value: Int!
  ): SetGaugeResponse!
}

Mutation Parameters

timestampDateTime!The timestamp indicating when the gauge set occurs.
subscriptionIdString!The uuid of the Salesbricks subscription associated with the customer. Obtain this value from the Public GraphQL API (also refered to as chain_id) and store it against your internal account ID for the customer.
brickIdString!The uuid of the Salesbricks Brick to which the counter relates.
valueInt!The number to set the gauge value to (e.g., 1).

Response

The setGauge mutation returns a boolean labeled success. This response should be considered an empty response.

Example

mutation {
  setGauge(
    subscriptionId: "00000000-0000-0000-0000-000000000000"
    brickId: "00000000-0000-0000-0000-000000000000"
    timestamp: "2020-01-11T10:15:30Z"
    value: 1
  ) {
    success
  }
}

Important Notes

  • To prevent duplicate requests and avoid over-charging customers, refer to the Idempotent Requests guide.
  • Ensure accurate values for timestamp, subscriptionId, brickId, and value are included in the mutation for desired gauge set.
  • The value parameter can not be negative and shouldn't be discrete (it should be the total/aggregated value).