Skip to main content
PATCH
/
rr
/
api
/
v1
/
contracts
/
{contract_id}
/
usage
/
{usage_id}
/
allocations
Partial Update Bundle Allocations
curl --request PATCH \
  --url https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "lines": [
    {
      "product": 123,
      "amount": 0
    }
  ]
}
'
import requests

url = "https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations"

payload = { "lines": [
{
"product": 123,
"amount": 0
}
] }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.patch(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'PATCH',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({lines: [{product: 123, amount: 0}]})
};

fetch('https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'lines' => [
[
'product' => 123,
'amount' => 0
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations"

payload := strings.NewReader("{\n \"lines\": [\n {\n \"product\": 123,\n \"amount\": 0\n }\n ]\n}")

req, _ := http.NewRequest("PATCH", url, payload)

req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.patch("https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"lines\": [\n {\n \"product\": 123,\n \"amount\": 0\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{usage_id}/allocations")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"lines\": [\n {\n \"product\": 123,\n \"amount\": 0\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "source_bundle": 123,
  "source_bundle_name": "<string>",
  "total_amount": 0,
  "currency": "<string>",
  "lines": [
    {
      "id": 123,
      "product": 123,
      "product_name": "<string>",
      "product_id_str": "<string>",
      "amount": 0,
      "percentage": "<string>",
      "original_percentage": 0
    }
  ],
  "created_at": "2023-11-07T05:31:56Z",
  "last_modified_at": "2023-11-07T05:31:56Z",
  "license_term_start_date": "2023-12-25"
}

Authorizations

Authorization
string
header
required

Token-based authentication with required prefix "Token"

Path Parameters

contract_id
integer
required
usage_id
integer
required

Body

Serializer for the allocation update request body.

lines
object[]

Response

200 - application/json

Serializer for ContractProductBundle with nested lines.

Used for retrieving and updating contract-specific bundle allocations. When updating, validates that line amounts sum to total_amount.

id
integer
required
read-only
source_bundle
integer | null
required
read-only

Original ProductBundle template this was created from

source_bundle_name
string | null
required
read-only
total_amount
number<double>
required
read-only

Total amount to be allocated across products

Required range: -1000000000000000000 < x < 1000000000000000000
currency
string
required
read-only
lines
object[]
required
created_at
string<date-time>
required
read-only
last_modified_at
string<date-time>
required
read-only
license_term_start_date
string<date> | null

Date the license/service term begins. For SF-ingested mixed bundles, drives the linked subscription start_date and milestone milestone_date. Snapshotted at ingest time for audit.