Variants
Variants help you manage things like internalization or A/B testing, i.e. when there are multiple versions of basically the same content piece involved.
List Variants
Lists the details of all registered variants.
ID of the variant
Label assigned to the variant
Description of the variant
Short, unique key for the variant (for use with the API)
curl --request GET \
--url "https://api.vrite.io/variants/list" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.variants.list();
[
{
"id": "739628be6176d13031e46ca6",
"label": "string",
"description": "string",
"key": "string"
}
]
Create Variant
Creates a new variant with a specified label, key, and optional description.
Label assigned to the variant
Description of the variant
Short, unique key for the variant (for use with the API)
ID of the variant
curl --request POST \
--url "https://api.vrite.io/variants" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"label": "{LABEL}",
"key": "{KEY}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
const result = await client.variants.create({
label: "string",
key: "string",
// Optional
description: "string",
});
{
"id": "911517baba7e3e30320c231b"
}
Update Variant
Updates the label, key, and description of the variant matched by ID, using the specified data.
ID of the variant
Label assigned to the variant
Description of the variant
Short, unique key for the variant (for use with the API)
curl --request PUT \
--url "https://api.vrite.io/variants" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"id": "{ID}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
await client.variants.update({
id: "50a84b1e854474a50eb34c53",
// Optional
label: "string",
// Optional
description: "string",
// Optional
key: "string",
});
Delete Variant
Deletes the variant specified by ID, removing all associated content pieces variants.
ID of the variant
curl --request DELETE \
--url "https://api.vrite.io/variants?id={ID}" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
await client.variants.delete({
id: "50a84b1e854474a50eb34c53",
});