Betfair Developers


Delphi
Discussions about Delphi development(pronounced DEHL-FAI). Delphi from Borland competes with Visual Basic as an offering for an object-oriented, visual programming approach to application development.

Thread Closed
Gratch Gratch is offline
Junior Member
 
Unhappy GetBetHistory - Internal Error

Hi Guys,

I was wondering whether anyone would be able to help me. I have been tinkering with the API for 12 months and I have been automating bets for a while now, but I can't seem to get GetBetHistory working at all. I get an internal error.

Here is my code for the method:

procedure TForm1.Button1Click(Sender: TObject);
var
rqst : BFExchangeServiceUK.GetBetHistoryReq;
rspn : BFExchangeServiceUK.GetBetHistoryResp;
EventID : BFExchangeServiceUK.ArrayOfInt;
MarketTypes : BFExchangeServiceUK.ArrayOfMarketTypeEnum;
begin
rqst := BFExchangeServiceUK.GetBetHistoryReq.Create;
rqst.header := BFExchangeServiceUK.APIRequestHeader.Create;
rqst.header.sessionToken := Header.sessionToken;

rqst.locale := 'en';
rqst.betTypesIncluded := BFExchangeServiceUK.S;
rqst.detailed := True;

Setlength(EventID, 1);
EventID[0] := 0;
rqst.eventTypeIds := EventID;

Setlength(MarketTypes, 1);
MarketTypes[0] := BFExchangeServiceUK.O;
rqst.marketTypesIncluded := MarketTypes;

rqst.placedDateFrom := TXSDateTime.Create;
rqst.placedDateFrom.AsDateTime := StrToDateTime('7/02/2012');
rqst.placedDateTo := TXSDateTime.Create;
rqst.placedDateTo.AsDateTime := Now;

rspn := (HTTPRIO2 as BFExchangeServiceUK.BFExchangeService).GetBetHisto ry(rqst);
Header.sessionToken := rspn.header.sessionToken;

rqst.Free;
rspn.Free;

end;

Last time I went through the internal error business it was that nasty NONE2 business, that I see many of you went through too.

Does anyone have any ideas?

Any help would be greatly appreciated.

Thanks,

Gratch
Gratch Gratch is offline
Junior Member
 
Default Sorted it!

I noticed there was a sneaky NONE3 for the sortBetsBy property. I specfied it as PLACED_DATE and it all worked fine.
Gratch Gratch is offline
Junior Member
 
Thumbs down No Results

Hi All,

It worked in the sense that it didn't error, but I am not getting any results back.

I have tried a whole range of event ids. Mine are all horse racing so I assumed they were eventid 7.

Here is my slightly amended code:

var
rqst : BFExchangeServiceUK.GetBetHistoryReq;
rspn : BFExchangeServiceUK.GetBetHistoryResp;
EventID : BFExchangeServiceUK.ArrayOfInt;
MarketTypes : BFExchangeServiceUK.ArrayOfMarketTypeEnum;
i, NoOfBets : Integer;
CurrentBet : BFExchangeServiceUK.Bet;
QueryBetList, QueryUpdate : TADOQuery;
begin
rqst := BFExchangeServiceUK.GetBetHistoryReq.Create;
rqst.header := BFExchangeServiceUK.APIRequestHeader.Create;
rqst.header.sessionToken := Header.sessionToken;

rqst.betTypesIncluded := BFExchangeServiceUK.S;
rqst.detailed := True;

Setlength(EventID, 1);
EventID[0] := 7;
rqst.eventTypeIds := EventID;

rqst.marketId := 0;

Setlength(MarketTypes, 1);
MarketTypes[0] := BFExchangeServiceUK.O;
rqst.marketTypesIncluded := MarketTypes;

rqst.placedDateFrom := TXSDateTime.Create;
rqst.placedDateFrom.AsDateTime := StrToDateTime('01/01/2012');
rqst.placedDateTo := TXSDateTime.Create;
rqst.placedDateTo.AsDateTime := Now;

rqst.recordCount := 99;

rqst.sortBetsBy := BFExchangeServiceUK.PLACED_DATE;

rspn := (HTTPRIO2 as BFExchangeServiceUK.BFExchangeService).GetBetHisto ry(rqst);
Header.sessionToken := rspn.header.sessionToken;


Any ideas? I just want to get the info on the bets i have place .
frizli frizli is offline
Junior Member
 
Default

An internal error poped out to me a few days ago on placeBets. It turned out some of my parameters were null. Not sure if that´s what you´re talking about.
wotsisname wotsisname is offline
Senior Member
 
Default

INTERNAL_ERROR is usually returned if the request has incorrect parameters. It is usually best to print out the request xml to see what's being sent and then refer to the API manual. There are a few parameters to be careful with:

Code:
<locale> and <timezone> must be set to a value or removed completely. I usually remove them.

<detailed> must be "true" or "false" (all lower case)

<placedDateFrom> and <placedDateTo> must be the correct format: "%Y-%m-%dT%H:%M:%S.000Z"
Depending what you are doing, you might find getAccountStatement more useful than getBetHistory because it also shows commission, whereas getBetHistory doesn't...
__________________
http://www.bespokebots.com
OzPunter OzPunter is offline
Senior Member
 
Default

Quote:
Originally Posted by Gratch View Post
Hi Guys,

I was wondering whether anyone would be able to help me. I have been tinkering with the API for 12 months and I have been automating bets for a while now, but I can't seem to get GetBetHistory working at all. I get an internal error.

Here is my code for the method:

procedure TForm1.Button1Click(Sender: TObject);
var
rqst : BFExchangeServiceUK.GetBetHistoryReq;
rspn : BFExchangeServiceUK.GetBetHistoryResp;
EventID : BFExchangeServiceUK.ArrayOfInt;
MarketTypes : BFExchangeServiceUK.ArrayOfMarketTypeEnum;
begin
rqst := BFExchangeServiceUK.GetBetHistoryReq.Create;
rqst.header := BFExchangeServiceUK.APIRequestHeader.Create;
rqst.header.sessionToken := Header.sessionToken;

rqst.locale := 'en';
rqst.betTypesIncluded := BFExchangeServiceUK.S;
rqst.detailed := True;

Setlength(EventID, 1);
EventID[0] := 0;
rqst.eventTypeIds := EventID;

Setlength(MarketTypes, 1);
MarketTypes[0] := BFExchangeServiceUK.O;
rqst.marketTypesIncluded := MarketTypes;

rqst.placedDateFrom := TXSDateTime.Create;
rqst.placedDateFrom.AsDateTime := StrToDateTime('7/02/2012');
rqst.placedDateTo := TXSDateTime.Create;
rqst.placedDateTo.AsDateTime := Now;

rspn := (HTTPRIO2 as BFExchangeServiceUK.BFExchangeService).GetBetHisto ry(rqst);
Header.sessionToken := rspn.header.sessionToken;

rqst.Free;
rspn.Free;

end;

Last time I went through the internal error business it was that nasty NONE2 business, that I see many of you went through too.

Does anyone have any ideas?

Any help would be greatly appreciated.

Thanks,

Gratch
Hi,
I have some code that works, there's a few things that need to be covered... Email me direct and I'll send you a working version. Carl@carlnielsen.net

Kind Regards
OzPunter
Thread Closed

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump