ชิงช้าสวรรค์ Voting API (1.0.0)

Download OpenAPI specification:

API for voting, coin/ticket management, and user/item/school info.

admin

Add free tickets

Authorizations:
bearerAuth
Request Body schema: application/json
required
userId
required
string
amount
required
integer
txnId
required
string
description
required
string

Responses

Request samples

Content type
application/json
{
  • "userId": "string",
  • "amount": 0,
  • "txnId": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Set exchange rates for coins

Replace existing rates if rateId exists. Set rates to 0 to disable each exchange type.

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
inputBaht
required
integer
outputCoins
required
integer

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "inputBaht": 0,
  • "outputCoins": 0
}

Set exchange rates for items

Replace existing rates if rateId exists. Set rates to 0 to disable each exchange type.

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
itemId
required
string
coinsPerItem
required
integer
ticketsPerItem
required
integer
votesPerItem
required
integer

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "itemId": "string",
  • "coinsPerItem": 0,
  • "ticketsPerItem": 0,
  • "votesPerItem": 0
}

Set exchange rates for tickets

Replace existing rate if rateId exists. Set rate to 0 to disable.

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
ticketsPerCoin
required
integer

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "ticketsPerCoin": 0
}

Get all exchange rates

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "coins": [
    ],
  • "items": [
    ],
  • "tickets": [
    ]
}

Get Idol items received by user

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get idol item transaction history by admin

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get idol votes by admin [updated feature]

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

type
string
Enum: "all" "normal" "express"

Vote type (default all)

Responses

Response samples

Content type
application/json
0
0

Exchange items (bonus)

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
userId
required
string
txnId
required
string
idolId
required
string
amount
required
integer

Number of item to get

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "userId": "string",
  • "txnId": "string",
  • "idolId": "string",
  • "amount": 0
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Set close voting time [new feature]

Authorizations:
bearerAuth
Request Body schema: application/json
required
startDate
required
string <date-time>
endDate
required
string <date-time>

Responses

Request samples

Content type
application/json
{
  • "startDate": "2019-08-24T14:15:22Z",
  • "endDate": "2019-08-24T14:15:22Z"
}

user

Exchange coins for tickets

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
txnId
required
string
amount
required
integer

Number of tickets to get

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "txnId": "string",
  • "amount": 0
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Exchange coins for items

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
txnId
required
string
idolId
required
string
amount
required
integer

Number of tickets to get

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "txnId": "string",
  • "idolId": "string",
  • "amount": 0
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Exchange tickets for items

Authorizations:
bearerAuth
Request Body schema: application/json
required
rateId
required
string
txnId
required
string
idolId
required
string
amount
required
integer

Number of tickets to get

Responses

Request samples

Content type
application/json
{
  • "rateId": "string",
  • "txnId": "string",
  • "idolId": "string",
  • "amount": 0
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Add free tickets

Authorizations:
bearerAuth
Request Body schema: application/json
required
amount
required
integer
txnId
required
string
description
required
string

Responses

Request samples

Content type
application/json
{
  • "amount": 0,
  • "txnId": "string",
  • "description": "string"
}

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Get user coin/ticket balance

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
{
  • "coins": 0,
  • "tickets": 0
}

Get user items balance

Authorizations:
bearerAuth

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get user baht transaction history

Authorizations:
bearerAuth
query Parameters
page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
{
  • "transactions": [
    ]
}

Get user coin transaction history

Authorizations:
bearerAuth
query Parameters
page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
{
  • "transactions": [
    ]
}

Get user ticket transaction history

Authorizations:
bearerAuth
query Parameters
page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
{
  • "transactions": [
    ]
}

Get Idol items received by user

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get idol item transaction history by user

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

page
integer

Page number

perPage
integer

Items per page

sortBy
string
Enum: "asc" "desc"

Sort by direction

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get idol votes by user [updated feature]

Authorizations:
bearerAuth
query Parameters
idolId
required
string

Idol ID

type
string
Enum: "all" "normal" "express"

Vote type (default all)

Responses

Response samples

Content type
application/json
0
0

Get transaction detail

Authorizations:
bearerAuth
path Parameters
txnId
required
string

Transaction ID

Responses

Response samples

Content type
application/json
[
  • {
    }
]

webhook

Omise webhook handler [updated feature]

Send [userId, rateId, txnId, description, fullname, taxPayerNumber, email, address, status, type, serviceName, failureMessage] into metadata of Omise Charge (JWT Signed with JWT_SECRET). After the transaction is complete, CP Origin will be hooked up to the Voting App.

Authorizations:
bearerAuth
Request Body schema: application/json
required
userId
string
rateId
string
amount
integer
txnId
string
omiseTxnId
string
description
string
fullName
string
taxPayerNumber
string
email
string
address
string
status
string
Enum: "pending" "successful" "failed"
type
string
Enum: "shop" "express"
serviceName
string
Enum: "inthe8ight" "chingchasawan"
failureMessage
string

Responses

Request samples

Content type
application/json
{
  • "userId": "695e1be5408fe79a94ca0d55",
  • "rateId": "p1-gen-001_Free",
  • "amount": 29,
  • "txnId": "CCSXXXXXXXXXXXXX",
  • "omiseTxnId": "chrg_test_xxxxxxxxxxxxxxxxxxx",
  • "description": "p1-gen-001 netPrice: 29 netTotalCoinAmount: 290",
  • "fullName": "Tester",
  • "taxPayerNumber": "string",
  • "email": "tester@chingchasawan.com",
  • "address": "string",
  • "status": "successful",
  • "type": "shop",
  • "serviceName": "chingchasawan",
  • "failureMessage": ""
}

omise

Create a charge from Voting App

Creates a new charge from Voting App using a card token or source ID.

Authorizations:
bearerAuth
Request Body schema: application/json
required
amount
required
integer

The amount in satang (e.g., 100.00 THB is 10000 satang).

currency
required
string

The currency for the charge (must be 'thb').

card
string

The card token (starts with tokn_). This is used for credit card payments.

source
string

The source ID (starts with src_)

return_uri
string <uri>

The URL to redirect the user to after completing the payment.

required
object

Additional metadata for the charge, wrapped in a JWT for security.

expires_at
required
string <date-time>

The expiration time for the charge in ISO 8601 format.

Responses

Request samples

Content type
application/json
{
  • "amount": 10000,
  • "currency": "thb",
  • "card": "tokn_test_XXXXXXXXXXXXXXXXXX",
  • "source": "src_test_XXXXXXXXXXXXXXXXXX",
  • "metadata": {
    },
  • "expires_at": "2026-01-09T18:00:00Z"
}