APIリファレンス
インスタントウィン
インスタントウィンゲームを管理し、プレイを記録する
インスタントウィン
インスタントウィンゲームは、サーバー側で賞品を抽選するシンプルなコンテストです。訪問者はまずプレイし、当選した賞品を受け取るときにだけメールアドレスを入力します。
mechanic、layout、entryLimitは作成時に設定され、後から変更することはできません。
ゲーム一覧
/api/v1/instant-win-gamesクエリパラメータ
slugstring optional プリセットで絞り込み:`spin-to-win`、`scratch-and-win`、`mystery-box`、`advent-calendar`、`plinko`、`slot-machine`、`golden-egg`、`claw-machine`のいずれか。提供を終了したプリセット(`trade-show-prize-wheel`、`daily-login-game`、`coupon-roulette`、`in-store-kiosk`)も、既存ゲームの絞り込み条件としては引き続き指定できます。
pagenumber optional default: 1ページ番号
limitnumber optional default: 201ページあたりの件数(1-100)
ゲーム取得
/api/v1/instant-win-games/:gameId設定、賞品ティア、当選確率、在庫数(quantity)、ユニークコードの件数を返します。
パブリックキーはWebページから読み取られる可能性があるため、パブリックキーで呼び出した場合、ティアのredeemCodeとredeemUrlはレスポンスに含まれません。これらを取得するにはプライベートキーを使用してください。
ゲーム作成
/api/v1/instant-win-gamesリクエストボディ
slugstring required プリセット識別子:`spin-to-win`、`scratch-and-win`、`mystery-box`、`advent-calendar`、`plinko`、`slot-machine`、`golden-egg`、`claw-machine`のいずれか
titlestring required ゲームのタイトル
mechanicstring required `wheel`、`scratch`、`box`、`advent`、`plinko`、`slots`、`egg`、`claw`のいずれか
layoutstring required `default`または`fullscreen`
entryLimitstring required `none`、`daily`、`device`のいずれか
tiersarray required 2つ以上のティア。当選確率の合計は100にする必要があります。ハズレ以外のティアには`redeemCode`または`redeemUrl`が必要です。
publishAsstring required `landing`または`embed`
embedUrlstring optional ウィジェットとして公開する場合は必須
リクエスト
curl -X POST https://blitzrocket.com/api/v1/instant-win-games \
-H "x-api-key: your_private_key_here" \
-H "Content-Type: application/json" \
-d '{
"slug": "spin-to-win",
"title": "Summer wheel",
"mechanic": "wheel",
"layout": "default",
"entryLimit": "daily",
"publishAs": "landing",
"tiers": [
{ "id": "win", "name": "20% off", "oddsPercent": 20, "deliveryType": "code", "redeemCode": "SUMMER20" },
{ "id": "miss", "name": "Try again", "oddsPercent": 80, "isMiss": true }
]
}'
ゲームの更新
/api/v1/instant-win-games/:gameIdタイトル、説明文、ティア、公開方法、ステータスを変更できます。mechanic、layout、entryLimitを変更しようとしても無視されます。
ゲームの削除
/api/v1/instant-win-games/:gameIdゲームに受け取り済みのエントリーがある場合は?force=trueを指定してください。指定しない場合、APIは409を返します。
プレイ
/api/v1/instant-win-games/:gameId/play重み付き抽選を実行します。当選は24時間確保されます。賞品の引き換え情報は、受け取りが完了するまで表示されません。
リクエストボディ
playCookiestring optional 前回のプレイで発行されたデバイスCookie。返された`playCookie`を保存して再利用してください。
レスポンス
{
"success": true,
"data": {
"playId": "play_abc",
"playCookie": "a1b2c3d4",
"alreadyPlayed": false,
"result": {
"id": "win",
"name": "20% off",
"isMiss": false,
"color": "#F59E0B"
}
}
}
entryLimitがdailyまたはdeviceの場合、そのCookieまたはIPアドレスですでにプレイ済みであれば403が返されます。
賞品の受け取り
/api/v1/instant-win-games/:gameId/plays/:playId/claimエントリーを作成してプレイを受け取り済みにし、賞品をメールで送信します。
リクエストボディ
emailstring required 当選者のメールアドレス
playCookiestring optional プレイ時に返されたものと同じCookie
レスポンス
{
"success": true,
"data": {
"alreadyClaimed": false,
"prizeName": "20% off",
"couponCode": "SUMMER20",
"redeemUrl": null
}
}
プレイ一覧
/api/v1/instant-win-games/:gameId/playsステータス(pending、claimed、miss、expired)、ティア、受け取りに使われたメールアドレスを含む、ページネーションされたプレイ履歴を返します。