Greyhounds.WebApi

<back to all web services

PlaceBets

The following routes are available for this service:
POST/bets/v2
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
Object = TypeVar('Object')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Reference:
    id: Optional[str] = None
    value: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BettingApp:
    name: Optional[str] = None
    version: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Origin:
    application: Optional[BettingApp] = None
    ip: Optional[str] = None
    organization: Optional[Reference] = None
    device: Optional[Reference] = None
    location: Optional[Reference] = None
    location_group: Optional[Reference] = None
    clerk: Optional[Reference] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Bet:
    id: Optional[str] = None
    jp_id: Optional[str] = None
    round_id: Optional[str] = None
    outcome_id: int = 0
    odds: float = 0.0
    stake: Decimal = decimal.Decimal(0)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PlaceBets:
    slip_id: Optional[str] = None
    bettor: Optional[Reference] = None
    origin: Optional[Origin] = None
    placed_at: datetime.datetime = datetime.datetime(1, 1, 1)
    bets: Optional[List[Bet]] = None

Python PlaceBets DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /bets/v2 HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	slipId: String,
	bettor: 
	{
		id: String,
		value: String
	},
	origin: 
	{
		application: 
		{
			name: String,
			version: String
		},
		ip: String,
		organization: 
		{
			id: String,
			value: String
		},
		device: 
		{
			id: String,
			value: String
		},
		location: 
		{
			id: String,
			value: String
		},
		locationGroup: 
		{
			id: String,
			value: String
		},
		clerk: 
		{
			id: String,
			value: String
		}
	},
	placedAt: 0001-01-01,
	bets: 
	[
		{
			id: String,
			jpId: String,
			roundId: String,
			outcomeId: 0,
			odds: 0,
			stake: 0
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	errorCode: String,
	message: String,
	stackTrace: String,
	errors: 
	[
		{
			errorCode: String,
			fieldName: String,
			message: String,
			meta: 
			{
				String: String
			}
		}
	],
	meta: 
	{
		String: String
	}
}