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

FieldTypeRequiredDescription
experimentKeynumberO๋ถ„๋ฐฐ ๋Œ€์ƒ A/B ํ…Œ์ŠคํŠธ ์‹คํ—˜ํ‚ค
userUser objectO๋ถ„๋ฐฐ ๋Œ€์ƒ ์‚ฌ์šฉ์ž

User Object

FieldTypeRequiredDescription
userIdstringX์‚ฌ์šฉ์ž ID (ํ•ตํด ํ†ตํ•ฉ์‹๋ณ„์ž ์‚ฌ์šฉ ๊ฐ€๋Šฅ)
deviceIdstringX๋””๋ฐ”์ด์Šค ID (ํ•ตํด ํ†ตํ•ฉ ์‹๋ณ„์ž ์‚ฌ์šฉ๊ฐ€๋Šฅ)
identifiersobjectX์‚ฌ์šฉ์ž ์ •์˜ ์‹๋ณ„์ž
key(string)-value(string) Pair
propertiesobjectX์‚ฌ์šฉ์ž ์†์„ฑ
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

FieldTypeDescription
variationstring๋ถ„๋ฐฐ๊ทธ๋ฃน (A, B, C, D, ...)
reasonstring๋ถ„๋ฐฐ์‚ฌ์œ 
parametersobject๋ถ„๋ฐฐ๊ทธ๋ฃน์— ์„ค์ •๋œ ํŒŒ๋ผ๋ฏธํ„ฐ

Example

{
  "variation": "B",
  "reason": "TRAFFIC_ALLOCATED",
  "parameters": {
    "buttonText": "Purchase",
    "buttonSize": 16
  }
}

400 Bad Request

์œ ํšจํ•˜์ง€ ์•Š์€ ์š”์ฒญ ์ •๋ณด์ธ ๊ฒฝ์šฐ 400 ์ƒํƒœ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.

401 Unauthorized

X-HACKLE-API-KEY ํ—ค๋”๊ฐ’์ด ์—†๊ฑฐ๋‚˜ ์œ ํšจํ•˜์ง€ ์•Š์€ SDK ํ‚ค์ธ ๊ฒฝ์šฐ 401 ์ƒํƒœ๋ฅผ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค