Skip to main content
PATCH
/
rr
/
api
/
v1
/
contracts
/
{contract_id}
/
usage
/
{id}
Partially Update Contract Usage Revenue
curl --request PATCH \
  --url https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{id} \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "contract": 123,
  "product": 123,
  "usage_group": 123,
  "department": 123,
  "tags": "<string>",
  "description": "<string>",
  "start_date": "2023-12-25",
  "end_date": "2023-12-25"
}
'
import requests

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

payload = {
"contract": 123,
"product": 123,
"usage_group": 123,
"department": 123,
"tags": "<string>",
"description": "<string>",
"start_date": "2023-12-25",
"end_date": "2023-12-25"
}
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({
contract: 123,
product: 123,
usage_group: 123,
department: 123,
tags: '<string>',
description: '<string>',
start_date: '2023-12-25',
end_date: '2023-12-25'
})
};

fetch('https://api.meetcampfire.com/rr/api/v1/contracts/{contract_id}/usage/{id}', 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/{id}",
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([
'contract' => 123,
'product' => 123,
'usage_group' => 123,
'department' => 123,
'tags' => '<string>',
'description' => '<string>',
'start_date' => '2023-12-25',
'end_date' => '2023-12-25'
]),
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/{id}"

payload := strings.NewReader("{\n \"contract\": 123,\n \"product\": 123,\n \"usage_group\": 123,\n \"department\": 123,\n \"tags\": \"<string>\",\n \"description\": \"<string>\",\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\"\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/{id}")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"contract\": 123,\n \"product\": 123,\n \"usage_group\": 123,\n \"department\": 123,\n \"tags\": \"<string>\",\n \"description\": \"<string>\",\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\"\n}")
.asString();
require 'uri'
require 'net/http'

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

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 \"contract\": 123,\n \"product\": 123,\n \"usage_group\": 123,\n \"department\": 123,\n \"tags\": \"<string>\",\n \"description\": \"<string>\",\n \"start_date\": \"2023-12-25\",\n \"end_date\": \"2023-12-25\"\n}"

response = http.request(request)
puts response.read_body
{
  "id": 123,
  "contract": 123,
  "product_bundle": "<string>",
  "contract_product_bundle": {
    "id": 123,
    "source_bundle_name": "<string>",
    "total_amount": 0,
    "lines": [
      {
        "id": 123,
        "product": 123,
        "product_name": "<string>",
        "amount": 0,
        "percentage": "<string>",
        "original_percentage": 0
      }
    ],
    "source_bundle": 123,
    "currency": "<string>"
  },
  "product_name": "<string>",
  "product_bundle_name": "<string>",
  "usage_group_name": "<string>",
  "lines": "<string>",
  "created_at": "2023-11-07T05:31:56Z",
  "last_modified_at": "2023-11-07T05:31:56Z",
  "product": 123,
  "usage_group": 123,
  "department": 123,
  "tags": "<string>",
  "description": "<string>",
  "start_date": "2023-12-25",
  "end_date": "2023-12-25"
}

Authorizations

Authorization
string
header
required

Token-based authentication with required prefix "Token"

Path Parameters

contract_id
integer
required
id
integer
required

Body

contract
integer
product
integer | null
usage_group
integer | null
department
integer | null
tags
string
description
string | null
start_date
string<date> | null
end_date
string<date> | null

Response

200 - application/json
id
integer
required
read-only
contract
integer
required
product_bundle
string
required
read-only
contract_product_bundle
object
required

Read-only serializer for ContractProductBundle in milestone responses.

product_name
string
required
read-only
product_bundle_name
string
required
read-only
usage_group_name
string
required
read-only
lines
string
required
read-only
created_at
string<date-time> | null
required
read-only
last_modified_at
string<date-time> | null
required
read-only
product
integer | null
usage_group
integer | null
department
integer | null
tags
string
description
string | null
start_date
string<date> | null
end_date
string<date> | null