A/B ํ ์คํธ
HTTP API๋ ์๋ฒ ํ๊ฒฝ์์๋ง ์ฌ์ฉํ ์ ์์ต๋๋ค.
HTTP API๋ฅผ ์ฌ์ฉํ์ฌ ์ฌ์ฉ์์ ๋ํ A/B ํ ์คํธ ๋ถ๋ฐฐ ๊ฒฐ๊ณผ๋ฅผ ํ์ธํ ์ ์์ต๋๋ค.
Authentication
SDK ํค๋ฅผ ํตํด ์ธ์ฆ์ ์งํํฉ๋๋ค. SDK ํค๋ฅผ HTTP ํค๋๋ก ์ ์กํด์ผ ํฉ๋๋ค.
API๋ฅผ ํธ์ถํ๋ ๊ณณ์๋ฐ๋ผ Browser, App, Server SDK ํค์ค ํ๋๋ฅผ ํค๋๋ก ์ค์ ํฉ๋๋ค.
X-HACKLE-API-KEY: {YOUR_SDK_KEY}
Request
POST https://api.hackle.io/v1/variation
Request Body
Field | Type | Required | Description |
---|---|---|---|
experimentKey | number | O | ๋ถ๋ฐฐ ๋์ A/B ํ ์คํธ ์คํํค |
user | User object | O | ๋ถ๋ฐฐ ๋์ ์ฌ์ฉ์ |
User Object
Field | Type | Required | Description |
---|---|---|---|
userId | string | X | ์ฌ์ฉ์ ID (ํตํด ํตํฉ์๋ณ์ ์ฌ์ฉ ๊ฐ๋ฅ) |
deviceId | string | X | ๋๋ฐ์ด์ค ID (ํตํด ํตํฉ ์๋ณ์ ์ฌ์ฉ๊ฐ๋ฅ) |
identifiers | object | X | ์ฌ์ฉ์ ์ ์ ์๋ณ์ key(string)-value(string) Pair |
properties | object | X | ์ฌ์ฉ์ ์์ฑ key(string)-value(string|number|boolean) Pair |
Example
curl -i -X POST \
'https://api.hackle.io/v1/variation' \
-H 'X-HACKLE-API-KEY: YOUR_SDK_KEY_HERE' \
-H 'Content-Type: application/json' \
-d '{
"experimentKey": 42,
"user": {
"userId": "19285035",
"deviceId": "ae2182e0",
"identifiers": {
"sessionId": "16930492542",
"myCustomId": "ff01eae2"
},
"properties": {
"grade": "GOLD",
"age": 30,
"isLogin": true
}
}
}'
Response
200 OK
์ฑ๊ณต์ ์ธ ์์ฒญ์ธ ๊ฒฝ์ฐ 200 ์๋ต๊ณผ ๋ถ๋ฐฐ ๊ฒฐ๊ณผ๋ฅผ ๋ฐํํฉ๋๋ค.
Response Body
Field | Type | Description |
---|---|---|
variation | string | ๋ถ๋ฐฐ๊ทธ๋ฃน (A, B, C, D, ...) |
reason | string | ๋ถ๋ฐฐ์ฌ์ |
parameters | object | ๋ถ๋ฐฐ๊ทธ๋ฃน์ ์ค์ ๋ ํ๋ผ๋ฏธํฐ |
Example
{
"variation": "B",
"reason": "TRAFFIC_ALLOCATED",
"parameters": {
"buttonText": "Purchase",
"buttonSize": 16
}
}
400 Bad Request
์ ํจํ์ง ์์ ์์ฒญ ์ ๋ณด์ธ ๊ฒฝ์ฐ 400 ์ํ๋ฅผ ๋ฐํํฉ๋๋ค.
401 Unauthorized
X-HACKLE-API-KEY
ํค๋๊ฐ์ด ์๊ฑฐ๋ ์ ํจํ์ง ์์ SDK ํค์ธ ๊ฒฝ์ฐ 401 ์ํ๋ฅผ ๋ฐํํฉ๋๋ค
Updated about 1 month ago