This is *not* a complete working example, but maybe it will help...
Code:
procedure TWagerPlacerForm.PlaceSingleBetButtonClick(Sender: TObject);
var bet : string;
paramstr : string;
len : integer;
i : integer;
DataBuffer : array [0..1000] of Byte;
str : string;
TicketID : string;
EventID : string;
RaceID : string;
BaseAmount : string;
Total : string;
Balance : string;
PoolID : string;
Runners : string;
begin
bet := '{ "CustomerId": "' + CustomerId + '",' +
' "DutchType": 0,' +
' "FileUploadName": null,' +
' "NickName": null,' +
' "RunId": "' + RunId + '",' +
' "TicketAmount": 2,' +
' "ToteTicketRequest": ' +
' {' +
' "CurrencyId": "USD",' +
' "EventId": "' + EventIdEdit.Text +'",' +
' "ParentStackId": "",' +
' "RaceId": ' + RaceIdEdit.Text + ',' +
' "StackId": "",' +
' "Wagers": ' +
' [' +
' {' +
' "BaseAmount": 2,' +
' "Bets": 1,' +
' "Legs": ' +
' [' +
' {' +
' "Auto": false,' +
' "Runners": "' + RunnersEdit.Text + '"' +
' }' +
' ],' +
' "Modifier": 0,' +
' "PoolId": "' + PoolEdit.Text + '",' +
' "Total": 2' +
' }' +
' ]' +
' }' +
'}';
paramstr := bet;
len := Length(paramstr);
for i := 1 to len do
DataBuffer[i - 1] := byte(paramstr[i]);
Response.Clear;
WebPostData(appname,
'wagerapi.amwager.com',
'api/ToteWagering/IssueSingleTicket',
@DataBuffer,len,
'application/json',
Token,
Response);
end;
Dan