Go Back   Developer Program Forum > Sports API > Delphi

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.

Post Reply
 
Thread Tools Display Modes
  #1  
Old 04-02-2012, 12:13 PM
Gratch Gratch is offline
Junior Member
 
Join Date: Jan 2011
Posts: 7
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
  #2  
Old 04-02-2012, 12:29 PM
Gratch Gratch is offline
Junior Member
 
Join Date: Jan 2011
Posts: 7
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.
  #3  
Old 04-02-2012, 03:10 PM
Gratch Gratch is offline
Junior Member
 
Join Date: Jan 2011
Posts: 7
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 .
  #4  
Old 05-22-2012, 07:39 AM
frizli frizli is offline
Junior Member
 
Join Date: Jan 2011
Posts: 10
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.
  #5  
Old 05-22-2012, 06:54 PM
wotsisname wotsisname is offline
Senior Member
 
Join Date: Jan 2009
Posts: 218
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
  #6  
Old 12-17-2013, 04:41 AM
OzPunter OzPunter is offline
Senior Member
 
Join Date: Apr 2009
Posts: 231
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
Post Reply

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


All times are GMT. The time now is 01:27 PM.


BETFAIR® and the BETFAIR LOGO are registered trade marks of The Sporting Exchange Limited. Data on Betfair website(s) (including pricing data) is protected by © and database rights. It may not be used for any purpose without a licence. © The Sporting Exchange Limited. All rights reserved.