curl -X POST \
/subscription-items/{subscriptionItemId}/entitlements \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"feature": "https:\/\/example.com\/",
"value": "",
"validFrom": "",
"validUntil": ""
}'import requests
url = "https://coreapi.io/subscription-items/{subscriptionItemId}/entitlements"
payload = {
"feature": "https://example.com/",
"value": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}
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({
feature: 'https://example.com/',
value: '<string>',
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z'
})
};
fetch('https://coreapi.io/subscription-items/{subscriptionItemId}/entitlements', 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://coreapi.io/subscription-items/{subscriptionItemId}/entitlements",
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([
'feature' => 'https://example.com/',
'value' => '<string>',
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z'
]),
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;
}{
"id": "<string>",
"subscriptionItem": {
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"status": "active",
"subscriptionId": "<string>"
},
"feature": {
"id": "feature-1",
"name": "number of users",
"description": "This feature allows you to manage the number of users in your account.",
"status": "active",
"type": "switch",
"config": [
{
"value": "<string>",
"label": "<string>"
}
],
"unit": "<string>"
},
"value": "true",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"active": true,
"status": "active"
}Add subscription item entitlement
Creates a Entitlement resource.
curl -X POST \
/subscription-items/{subscriptionItemId}/entitlements \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"feature": "https:\/\/example.com\/",
"value": "",
"validFrom": "",
"validUntil": ""
}'import requests
url = "https://coreapi.io/subscription-items/{subscriptionItemId}/entitlements"
payload = {
"feature": "https://example.com/",
"value": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}
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({
feature: 'https://example.com/',
value: '<string>',
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z'
})
};
fetch('https://coreapi.io/subscription-items/{subscriptionItemId}/entitlements', 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://coreapi.io/subscription-items/{subscriptionItemId}/entitlements",
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([
'feature' => 'https://example.com/',
'value' => '<string>',
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z'
]),
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;
}{
"id": "<string>",
"subscriptionItem": {
"id": "01F9ZQZJZJQZJZJZJZJZJZJZJZ",
"name": "Fitness M",
"description": "Everything included",
"furtherInformation": "Additional agreements: The contract includes a free drink flatrate.",
"status": "active",
"subscriptionId": "<string>"
},
"feature": {
"id": "feature-1",
"name": "number of users",
"description": "This feature allows you to manage the number of users in your account.",
"status": "active",
"type": "switch",
"config": [
{
"value": "<string>",
"label": "<string>"
}
],
"unit": "<string>"
},
"value": "true",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"active": true,
"status": "active"
}Autorisierungen
Body
The new Entitlement resource
The date from which the feature is valid. A date-time with an offset or a zone (2026-11-01T10:00:00+01:00, 2026-11-01T09:00:00Z) is taken as given; a date-time without a zone (2026-11-01T10:00:00) is read in the organisation's time zone; a date alone (2026-11-01) is 00:00 in the organisation's time zone. Stored as an instant and returned as an ISO-8601 date-time with offset.
The date until which the feature is valid. A date-time with an offset or a zone (2026-11-01T10:00:00+01:00, 2026-11-01T09:00:00Z) is taken as given; a date-time without a zone (2026-11-01T10:00:00) is read in the organisation's time zone; a date alone (2026-11-01) is 00:00 in the organisation's time zone. Stored as an instant and returned as an ISO-8601 date-time with offset.
Antwort
Entitlement resource created
Get all entitlements of a subscription
The status of the entitlement. Computed based on validity dates and enabled state.
Possible values:
active: Entitlement is enabled and currently within its validity periodpending: Entitlement is enabled but validFrom is in the futuredisabled: Entitlement is manually disabledexpired: Entitlement validUntil date has passed
active, pending, disabled, expired "active"
War diese Seite hilfreich?