Create a Context
POSThttps://sandbox.absmartly.io/v1/context
A POST request for creating a new context and assigning variants to your users.
Request
Header Parameters
X-Agent stringrequired
The User-Agent of your SDK.
Example: absmartly-Java-SDK v1.0.1
X-Environment stringrequired
The environment in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
Example: development
X-Application stringrequired
The application in which you are running your experiments. These can be found and created in your ABsmartly Web Console settings.
Example: www
X-Application-Version int64required
The application version which you are running your experiments on.
Example: 0
- application/json
Body
required
Units data for which to create the context and variant assignments. Unit types can be found and created in your ABsmartly Web Console settings.
{
"type": "user_id" // The name of the unit type
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408" // The value of the unit that you are tracking.
}
units object[]required
Responses
- 200
- 400
- 401
- default
Success
- application/json
- Schema
- Example (from schema)
Schema
units object[]required
assignments object[]required
{
"units": [
{
"type": "user_id",
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408"
}
],
"assignments": [
{
"id": 3,
"iteration": 2,
"name": "exp_banner_color",
"variant": 1,
"eligible": true,
"audienceMismatch": false,
"originalVariant": 1,
"config": "string"
}
]
}
Bad request
- application/json
- Schema
- Example (from schema)
Schema
code int64required
message stringrequired
{
"code": 0,
"message": "string"
}
Unauthorized
Unexpected error
- application/json
- Schema
- Example (from schema)
Schema
code int64required
message stringrequired
{
"code": 0,
"message": "string"
}
Authorization: X-API-Key
name: X-API-Keytype: apiKeyin: headerrequired: true
- curl
- python
- go
- nodejs
- ruby
- csharp
- php
- java
- powershell
- CURL
curl -L -X POST 'https://sandbox.absmartly.io/v1/context' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'X-API-Key: <API_KEY_VALUE>' \
--data-raw '{
"units": [
{
"type": "user_id",
"uid": "4a42766ca6313d26f49985e799ff4f3790fb86efa0fce46edb3ea8fbf1ea3408"
}
]
}'
ResponseClear