Create attributes
// -------------------------------------------------------------------------- //
// Create attributes. //
// -------------------------------------------------------------------------- //
// --------------------------- is_logged_in attribute -------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "is_logged_in",
"project_id": {{projectId}}
}
###
// ------------------------- days_since_last_order attribute ------------------------ //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "days_since_last_order",
"project_id": {{projectId}}
}
###
// ---------------------------- region_state attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "region_state",
"project_id": {{projectId}}
}
###
// ---------------------------- is_mobile_user attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "is_mobile_user",
"project_id": {{projectId}}
}
###
// ---------------------------- is_mobile_app attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "is_mobile_app",
"project_id": {{projectId}}
}
###
// ---------------------------- is_qa attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "is_qa",
"project_id": {{projectId}}
}
###
// ---------------------------- qa_team attribute --------------------------- //
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}
{
"key": "qa_team",
"project_id": {{projectId}}
}Create seven audience attributes using the Create an attribute API endpoint. Attributes are used to target your audiences.
Prerequisite
Before running this request, you must follow the instructions to configure your REST API cookbook.
Create a file
Create a file named create-attributes.rest and copy and paste the recipe into the file.
Configure API
{{baseUrl}} and {{token}} are defined in the settings.json file. Ensure you have configured your Visual Studio Code project correctly. See Configure the Visual Studio Code REST Client.
POST {{baseUrl}}/attributes
Content-Type: application/json
Authorization: {{token}}Create is_logged_in attribute
Create is_logged_in attribute.
Click Send Request in Visual Studio Code.
Remember, any attribute created in a project remains in the datafile.
{{projectId}} is defined in the settings.json file. See the previous step for details.
{
"key": "is_logged_in",
"project_id": {{projectId}}
}The ### delimiter
The REST Client extension delimits multiple requests using ###. See Main features in the REST Client documentation.
Create days_since_last_order attribute
Create days_since_last_order attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "days_since_last_order",
"project_id": {{projectId}}
}Create region_state attribute
Create region_state attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "region_state",
"project_id": {{projectId}}
}Create is_mobile_user attribute
Create is_mobile_user attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "is_mobile_user",
"project_id": {{projectId}}
}Create is_mobile_app attribute
Create is_mobile_app attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "is_mobile_app",
"project_id": {{projectId}}
}Create is_qa attribute
Create is_qa attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "is_qa",
"project_id": {{projectId}}
}Create qa_team attribute
Create qa_team attribute.
Click Send Request in Visual Studio Code.
{{projectId}} is defined in the settings.json file. See the Configure API step for details.
{
"key": "qa_team",
"project_id": {{projectId}}
}Attributes in UI
After sending all requests, your Attributes should look like the following in the UI: