Lottery
GET/api/v1/lottery
Authorization
bearer_token In: header
Query Parameters
Full-text search query applied to table name and description
1-indexed page number
int640 <= valuePage size
int640 <= valueSort field (created_at, item_count, total_weight)
Sort order (asc or desc)
Value in
- "asc"
- "desc"
Additional filter expressions in the form field:operator:value
Response Body
application/json
curl -X GET "https://example.com/api/v1/lottery"{ "pagination": { "has_more": true, "page": 0, "page_size": 0, "total": 0 }, "tables": [ { "created_at": "2019-08-24T14:15:22Z", "name": "string", "size": 0, "total_weight": 0 } ]}GET/api/v1/lottery/{table_name}
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
Response Body
application/json
curl -X GET "https://example.com/api/v1/lottery/string"{ "created_at": "2019-08-24T14:15:22Z", "description": "string", "items": [ { "item_id": "string", "percentage": 0.1, "weight": 0 } ], "size": 0, "table_name": "string", "total_weight": 0, "updated_at": "2019-08-24T14:15:22Z"}POST/api/v1/lottery/{table_name}
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/api/v1/lottery/string" \ -H "Content-Type: application/json" \ -d '{ "item_id": "string", "weight": 0 }'{ "item_id": "string", "previous_weight": 0, "table_size": 0, "weight": 0}DELETE/api/v1/lottery/{table_name}
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table to delete
Response Body
application/json
curl -X DELETE "https://example.com/api/v1/lottery/string"{ "items_removed": 0, "table_name": "string"}POST/api/v1/lottery/{table_name}/adjust-weight
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/api/v1/lottery/string/adjust-weight" \ -H "Content-Type: application/json" \ -d '{ "increment": 0, "item_id": "string" }'{ "item_id": "string", "new_weight": 0, "previous_weight": 0}POST/api/v1/lottery/{table_name}/batch
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
A batch of weighted items to add to one lottery table. Items are applied independently and fail-fast; the server enforces a per-batch cap.
Response Body
application/json
curl -X POST "https://example.com/api/v1/lottery/string/batch" \ -H "Content-Type: application/json" \ -d '{ "items": [ { "item_id": "string", "weight": 0 } ] }'{ "count": 0, "results": [ { "item_id": "string", "previous_weight": 0, "table_size": 0, "weight": 0 } ]}POST/api/v1/lottery/{table_name}/draw
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X POST "https://example.com/api/v1/lottery/string/draw" \ -H "Content-Type: application/json" \ -d '{}'{ "items": [ { "item_id": "string", "meta": null, "weight": 0 } ], "table_size": 0, "total_weight": 0}DELETE/api/v1/lottery/{table_name}/{item_id}
Authorization
bearer_token In: header
Path Parameters
Name of the lottery table
ID of the item to delete
Response Body
application/json
curl -X DELETE "https://example.com/api/v1/lottery/string/string"{ "item_id": "string", "removed": true, "table_size": 0}