|
|||||||
| 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
|
|||
|
|||
|
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 |
|
#3
|
|||
|
|||
|
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 .
|
|
#5
|
|||
|
|||
|
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"
__________________
http://www.bespokebots.com |
| Post Reply |
| Thread Tools | |
| Display Modes | |
|
|