Get subscription quantity history
curl --request POST \
--url https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"contract_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c"
}
'import requests
url = "https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory"
payload = {
"customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"contract_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
subscription_id: '1a824d53-bde6-4d82-96d7-6347ff227d5c'
})
};
fetch('https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory', 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.metronome.com/v1/contracts/getSubscriptionQuantityHistory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => '13117714-3f05-48e5-a6e9-a66093f13b4d',
'contract_id' => 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
'subscription_id' => '1a824d53-bde6-4d82-96d7-6347ff227d5c'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.metronome.com/v1/contracts/getSubscriptionQuantityHistory"
payload := strings.NewReader("{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c",
"fiat_credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
"history": [
{
"starting_at": "2020-01-01T00:00:00.000Z",
"data": [
{
"quantity": 100,
"unit_price": 1000,
"total": 100000
}
]
},
{
"starting_at": "2020-02-01T00:00:00.000Z",
"data": [
{
"quantity": 100,
"unit_price": 1000,
"total": 100000
},
{
"quantity": 200,
"unit_price": 2000,
"total": 400000
}
]
}
]
}
}{
"message": "<string>"
}Contracts
Get subscription quantity history
Get the history of subscription quantities and prices over time for a given subscription_id. This endpoint can be used to power an in-product experience where you show a customer their historical changes to seat count. Future changes are not included in this endpoint - use the getContract endpoint to view the future scheduled changes to a subscription’s quantity.
Subscriptions are used to model fixed recurring fees as well as seat-based recurring fees. To model changes to the number of seats in Metronome, you can increment or decrement the quantity on a subscription at any point in the past or future.
POST
/
v1
/
contracts
/
getSubscriptionQuantityHistory
Get subscription quantity history
curl --request POST \
--url https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"contract_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c"
}
'import requests
url = "https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory"
payload = {
"customer_id": "13117714-3f05-48e5-a6e9-a66093f13b4d",
"contract_id": "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
contract_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
subscription_id: '1a824d53-bde6-4d82-96d7-6347ff227d5c'
})
};
fetch('https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory', 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.metronome.com/v1/contracts/getSubscriptionQuantityHistory",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'customer_id' => '13117714-3f05-48e5-a6e9-a66093f13b4d',
'contract_id' => 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
'subscription_id' => '1a824d53-bde6-4d82-96d7-6347ff227d5c'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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.metronome.com/v1/contracts/getSubscriptionQuantityHistory"
payload := strings.NewReader("{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.post("https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.metronome.com/v1/contracts/getSubscriptionQuantityHistory")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"13117714-3f05-48e5-a6e9-a66093f13b4d\",\n \"contract_id\": \"d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc\",\n \"subscription_id\": \"1a824d53-bde6-4d82-96d7-6347ff227d5c\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"subscription_id": "1a824d53-bde6-4d82-96d7-6347ff227d5c",
"fiat_credit_type_id": "2714e483-4ff1-48e4-9e25-ac732e8f24f2",
"history": [
{
"starting_at": "2020-01-01T00:00:00.000Z",
"data": [
{
"quantity": 100,
"unit_price": 1000,
"total": 100000
}
]
},
{
"starting_at": "2020-02-01T00:00:00.000Z",
"data": [
{
"quantity": 100,
"unit_price": 1000,
"total": 100000
},
{
"quantity": 200,
"unit_price": 2000,
"total": 400000
}
]
}
]
}
}{
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Success
Show child attributes
Show child attributes
⌘I