Update a feature credits entry
curl --request PATCH \
--url https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"effectiveUntil": "2023-02-23T14:25:10Z",
"granted": 200
}
'import requests
url = "https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}"
payload = {
"effectiveUntil": "2023-02-23T14:25:10Z",
"granted": 200
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({effectiveUntil: '2023-02-23T14:25:10Z', granted: 200})
};
fetch('https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_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.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_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([
'effectiveUntil' => '2023-02-23T14:25:10Z',
'granted' => 200
]),
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.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}"
payload := strings.NewReader("{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}"
response = http.request(request)
puts response.read_body{
"id": "purchase.20rvWRxQcQK.0ZwPG$1",
"status": "ACTIVE",
"source": "ENTITLEMENT",
"effectiveFrom": "2020-01-01T00:00:00Z",
"effectiveUntil": "2025-01-01T00:00:00Z",
"granted": 15,
"balance": 10,
"used": 5
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<Reason message>"
}Entitlements
Update a feature credits entry
This API letβs you to update the following attributes: effectiveUntil and granted
- effectiveUntil: must be in future
- granted: must be greater than the existing usage (previous granted - current balance)
PATCH
/
accounts
/
{account_id}
/
features
/
{feature_id}
/
entries
/
{entry_id}
Update a feature credits entry
curl --request PATCH \
--url https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"effectiveUntil": "2023-02-23T14:25:10Z",
"granted": 200
}
'import requests
url = "https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}"
payload = {
"effectiveUntil": "2023-02-23T14:25:10Z",
"granted": 200
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({effectiveUntil: '2023-02-23T14:25:10Z', granted: 200})
};
fetch('https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_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.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_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([
'effectiveUntil' => '2023-02-23T14:25:10Z',
'granted' => 200
]),
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.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}"
payload := strings.NewReader("{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.togai.com/accounts/{account_id}/features/{feature_id}/entries/{entry_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"effectiveUntil\": \"2023-02-23T14:25:10Z\",\n \"granted\": 200\n}"
response = http.request(request)
puts response.read_body{
"id": "purchase.20rvWRxQcQK.0ZwPG$1",
"status": "ACTIVE",
"source": "ENTITLEMENT",
"effectiveFrom": "2020-01-01T00:00:00Z",
"effectiveUntil": "2025-01-01T00:00:00Z",
"granted": 15,
"balance": 10,
"used": 5
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<string>"
}{
"message": "<Reason message>"
}Example: Increase grantedUnits
Example: Increase grantedUnits
Initial:Action: Update granted units to 120 unitsPOST OutputAdjustment units = new granted units - previous granted units (120β100=20)New balance = current balance + adjustment units (20+20=40)
{
"id": "<entry_id>",
"source": PURCHASE",
"accountId": "acc.fdjsl.313",
"featureId": "feat.fdjsl.313",
"granted": 100,
"balance": 20
}
/accounts/acc.fdjsl.313/features/feat.fdjsl.313/entries/<entry_id>{
"grantedUnits": 120
}
Example: Reduce grantedUnits
Example: Reduce grantedUnits
Initial:Action: Update granted units to 70 unitsPOST OutputAdjustment units = new granted units - previous granted units (70β100=β30)New balance = current balance + adjustment units (20+(β30)=β10) ->
{
"id": "<entry_id>",
"source": PURCHASE",
"accountId": "acc.fdjsl.313",
"featureId": "feat.fdjsl.313",
"granted": 100,
"balance": 20
}
/accounts/acc.fdjsl.313/features/feat.fdjsl.313/entries/<entry_id>{
"granted": 70
}
400 Bad RequestAuthorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
account_id corresponding to an account
Maximum string length:
50Example:
"ACC00001"
feature_id corresponding to a feature
Maximum string length:
50Example:
"feat.fdjskl.sdkjl"
entryId corresponding to a particular entitlement/overage grant entry
Formats:
- If source of entry is an entitlement grant rate card in price plan:
schedule_id#pricing_cycle_start_date$PRICE_PLAN - If source of entry is an entitlement overage rate card in price plan:
schedule_id#pricing_cycle_start_date$OVERAGE - If source of entry is a purchase:
purchase_id#int_index$PURCHASE
Maximum string length:
50Example:
"purchase.21HbazIT3JQ.D90jC#1$PURCHASE"
Body
application/json
Response
Success response
Get feature credits response
Maximum string length:
50Example:
"purchase.20rvWRxQcQK.0ZwPG$1"
Source of the feature credit
Available options:
ENTITLEMENT, PRICE_PLAN, OVERAGE, REFUND Status of the feature credit entry
Available options:
ACTIVE, EXPIRED, VOIDED Example:
"2021-03-04T14:25:10Z"
Example:
"2021-05-20T01:00:10Z"
Example:
10
Example:
15
Example:
10
