API 文档
用于 投注与彩票结算 的系统集成
本系统专为体育博彩运营商、博彩公司和平台开发商设计,旨在实现投注计算和彩票管理流程的自动化。它允许快速集成结果计算,提供有关彩票状态(赢、输或退款)的精准数据,并简化了运营商服务器与计算系统之间的交互。
REST over HTTPSJSON onlyPackage header authapi.sportapi.net
POST /v1/couponjson
{
"coupon_id": "A7F3K9",
"type": "express",
"events": [
{ "id": 88213, "pick": "1", "odds": 2.10, "result": "win" },
{ "id": 88150, "pick": "over_2_5", "odds": 1.80, "result": "win" }
],
"total_odds": 3.78, "status": "won"
}01 — 系统如何工作?
02 — 用户授权
错误响应json
"errorCode":1,
"fullErrorCode":99,
"errorMessage":"Invalid access level"03 — 发送请求的示例(使用经理提供的数据):
POST {APIHOST}/WebServices/BCService.asmx/LogIn/python
import requests
import json
url = "https://example-domain-calc.com/WebServices/BCService.asmx/LogIn/"
payload = json.dumps({
"login": "demo-login@demosportapi.net",
"password": "demo-password"
})
headers = {
'Content-Type': 'application/json'
}
print(response.text)04 — 投注或彩票提交方法
负载主体示例json
{
"data":{
"list_bets":[
"line#586464528|17|954|2.5#4.27", "live#586464528|87|4|0#1.12"
],
"realAmount":"2",
"currency":"USD",
"lang":"en",
"remote_host":"https://mysites.com",
"rate_mode":"reject"
}
}05 — remote_host 和 rate_mode 参数
06 — 响应字段与错误说明
07 — 操作成功
操作成功json
{
"errorCode": 0,
"fullErrorCode": 0,
"errorMessage": ""
}08 — 错误代码
常规错误json
{
"errorCode": 1,
"fullErrorCode": [ERROR_CODE],
"errorMessage": "[ERROR_DESCRIPTION]"
}09 — 赔率变化时的错误处理建议
赔率变化时的错误处理建议json
{
"errorCode":1,
"fullErrorCode":2,
"errorMessage":"Odds have changed",
"rate_mode":"reject",
"changed":[
{
"gid":"586464528", // match ID
"rb":2.15, // odds in your coupon
"rg":"2.27", // current real odds
"rt":0 // status of change. 0 - decreased, 1 - increased
}
]
}10 — 发送计算结果
单张彩票的数据示例json
{
"remote_host": "https://mysite.com",
"Heads": [{
"KeyHead": {
"Id": "344143",
"BarCode": "x9c52i8411"
},
"Status": 2,
"ExtStatus": 0,
"AmountOut": 11130,
"DateReceive": "1597075782"
}]
}11 — 多张彩票的数据示例
多张彩票的数据示例json
{
"remote_host": "https://mysite.com",
"Heads": [{
"KeyHead": {
"Id": "313",
"BarCode": "75vz48t935"
},
"Status": 2,
"ExtStatus": 0,
"AmountOut": 19.85,
"DateReceive": "1592937968"
}, {
"KeyHead": {
"Id": "312",
"BarCode": "77i0r6e15t"
},
"Status": 2,
"ExtStatus": 0,
"AmountOut": 12.51,
"DateReceive": "1592937280"
}]
}