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
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Pfadparameter
Entitlement identifier
Body
The new Entitlement resource
The feature which should be assigned. Must be in "active" state.
"https://example.com/"
The value of the feature
The date from which the feature is valid
The date until which the feature is valid
Antwort
Entitlement resource created
Get all entitlements of a subscription
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The value of the entitlement. Can be a boolean (switch), a string (custom), a number (quantity) or a custom number (range).
"true"
The date from which the entitlement is valid
The date until which the entitlement is valid
Whether the entitlement is currently active (computed based on validity dates and enabled state)
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?