Hi
Newbie here with the Betfair API and C# to an extent too. I am trying to add some new functionality to the C# example from this forum. I got a call such as API getBet to work OK and return the details of a single bet. However, I cant get the cancelBets call to work, it always returns TAKEN_OR_LAPSED for each of the individual bets in the array(I am just trying to cancel 1 bet in array index 0). I create an unmatched bet via either Cymatic or the website and then get the bet ID from Cymatic of the bet I am trying to cancel. (For now just hard coded that ID into my code)
I think I have set the request up correctly and populated the array, but I must be missing something obvious. here is my code snippets.
Then tested with
Can anyone spot what I am doing wrong ?
Thanks for any help
Regards Geoff
Newbie here with the Betfair API and C# to an extent too. I am trying to add some new functionality to the C# example from this forum. I got a call such as API getBet to work OK and return the details of a single bet. However, I cant get the cancelBets call to work, it always returns TAKEN_OR_LAPSED for each of the individual bets in the array(I am just trying to cancel 1 bet in array index 0). I create an unmatched bet via either Cymatic or the website and then get the bet ID from Cymatic of the bet I am trying to cancel. (For now just hard coded that ID into my code)
I think I have set the request up correctly and populated the array, but I must be missing something obvious. here is my code snippets.
Code:
public bool myCancelBets(ref CancelBetsResp response, CancelBets[] bets)
{
bool bRetCode;
const string serviceName = "cancelBets";
var request = new CancelBetsReq();
request.bets = bets;
request.header = _exchReqHdr;
response = _bfExchange.cancelBets(request);
bRetCode = CheckResponse(serviceName,
Convert.ToString(response.header.errorCode),
Convert.ToString(response.errorCode),
response.header.sessionToken);
if (bRetCode == false)
return false;
return true;
}
Code:
private void button1_Click(object sender, EventArgs e)
{
CancelBets[] bets = new CancelBets[40];
CancelBetsResp Response = new CancelBetsResp();
for (int i=0; i < bets.Length ; i++ )
{
bets[i] = new CancelBets();
}
bets[0].betId = 37198397685;
MyBetfair.myCancelBets(ref Response, bets);
}
Thanks for any help
Regards Geoff


Comment