cURL
curl -X POST \
/entitlement/feature-assignments \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"feature": "https:\/\/example.com\/",
"value": "",
"validFrom": "",
"validUntil": "",
"objectId": "",
"applyToExistingSubscriptions": ""
}'import requests
url = "https://coreapi.io/entitlement/feature-assignments"
payload = {
"feature": "https://example.com/",
"value": "<string>",
"objectId": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"applyToExistingSubscriptions": True
}
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>',
objectId: '<string>',
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z',
applyToExistingSubscriptions: true
})
};
fetch('https://coreapi.io/entitlement/feature-assignments', 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/entitlement/feature-assignments",
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>',
'objectId' => '<string>',
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z',
'applyToExistingSubscriptions' => true
]),
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>",
"object": "product-price",
"objectId": "<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>"
},
"name": "<string>",
"value": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}Feature & Entitlement
Assign feature
Creates a Feature resource.
POST
/
entitlement
/
feature-assignments
cURL
curl -X POST \
/entitlement/feature-assignments \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"feature": "https:\/\/example.com\/",
"value": "",
"validFrom": "",
"validUntil": "",
"objectId": "",
"applyToExistingSubscriptions": ""
}'import requests
url = "https://coreapi.io/entitlement/feature-assignments"
payload = {
"feature": "https://example.com/",
"value": "<string>",
"objectId": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z",
"applyToExistingSubscriptions": True
}
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>',
objectId: '<string>',
validFrom: '2023-11-07T05:31:56Z',
validUntil: '2023-11-07T05:31:56Z',
applyToExistingSubscriptions: true
})
};
fetch('https://coreapi.io/entitlement/feature-assignments', 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/entitlement/feature-assignments",
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>',
'objectId' => '<string>',
'validFrom' => '2023-11-07T05:31:56Z',
'validUntil' => '2023-11-07T05:31:56Z',
'applyToExistingSubscriptions' => true
]),
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>",
"object": "product-price",
"objectId": "<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>"
},
"name": "<string>",
"value": "<string>",
"validFrom": "2023-11-07T05:31:56Z",
"validUntil": "2023-11-07T05:31:56Z"
}Autorisierungen
Body
application/jsontext/html
The new Feature resource
Assign a feature
Antwort
Feature resource created
Get feature assignments
War diese Seite hilfreich?