Hi guys,
We have been going in circles with the below errors and cant seem to get past this step.
Any help would be greatly appreciated.
This is in regards to section 4.3.1 Create a new bet placement order with API
https://api.mollybet.com/docs/v1/#create-a-new-bet-placement-order.
The client used is c# Httpclient, and we are sending the parameters as JSON body.
JSON request parameters:
{
"betslip_id":"aff87f1773774ef7b04e81992c038e8f",
"price":"2.06",
"stake":"[\"EUR\", 13]",
"duration":"15",
"accounts":"[\"ibc\", \"_99899bb2_\"]",
"adaptive_bookies":"[ibc]",
"ignore_system_maintenance":false,
"no_put_offer_exchange":false,
"bookie_min_stakes":"{}",
"user_data":null
}
The c# code that generates the JSON :
private void doPlace(string betSlipId,double price , double stake , string bookie, string accountName)
{
try
{
//string placebetLink = "https://pro.sportmarket.com/trade/place_order";
//var postData = new FormUrlEncodedContent(new[]
//{
// new KeyValuePair<string,string>("betslip_id",betSlipId),
// new KeyValuePair<string,string>("price" , price.ToString()),
// new KeyValuePair<string, string>("request_uuid",getRandom()),
// new KeyValuePair<string, string>("timeout","20"),
// new KeyValuePair<string,string>("stake",stake.ToString()),
// new KeyValuePair<string,string>("accounts",accountName),
// new KeyValuePair<string,string>("adaptive",bookie),
// new KeyValuePair<string, string>("ignore_autoplacing","false"),
// new KeyValuePair<string, string>("csrfmiddlewaretoken", csrToken)
//});
//HttpResponseMessage placeResponse = httpClient.PostAsync(placebetLink, postData).Result;
//placeResponse.EnsureSuccessStatusCode();
//string content = placeResponse.Content.ReadAsStringAsync().Result;
//ApiClient.DefaultRequestHeaders.TryAddWithoutValidation("X-Requested-With", "XMLHttpRequest");
httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json");
string stakeStr = string.Format("[\"EUR\", {0}]", stake);
string placebetUrl = string.Format("{0}v1/orders/", endPonit);
//var postData = new FormUrlEncodedContent(new[]
//{
// new KeyValuePair<string,string>("betslip_id",betSlipId),
// new KeyValuePair<string,string>("price" , price.ToString()),
// new KeyValuePair<string,string>("stake",stakeStr),
// new KeyValuePair<string,string>("duration","15"),
// new KeyValuePair<string,string>("accounts",accountName),
// new KeyValuePair<string,string>("adaptive_bookies",string.Format("[{0}]",bookie)),
// new KeyValuePair<string, string>("ignore_system_maintenance","false"),
// new KeyValuePair<string, string>("no_put_offer_exchange","false"),
// new KeyValuePair<string, string>("bookie_min_stakes","{}"),
// new KeyValuePair<string, string>("user_data","")
//});
PlaceRequest requestJson = new PlaceRequest();
requestJson.betslip_id = betSlipId;
requestJson.price = price.ToString();
requestJson.stake = stakeStr;
requestJson.accounts = accountName;
requestJson.duration = "15";
requestJson.adaptive_bookies = string.Format("[{0}]", bookie);
requestJson.ignore_system_maintenance = false;
requestJson.no_put_offer_exchange = false;
requestJson.bookie_min_stakes = "{}";
string jsonStr = JsonConvert.SerializeObject(requestJson);
HttpResponseMessage placeResponse = ApiClient.PostAsync(placebetUrl, new StringContent(jsonStr, Encoding.UTF8, "application/json")).Result;
placeResponse.EnsureSuccessStatusCode();
string content = placeResponse.Content.ReadAsStringAsync().Result;
}
catch (Exception e)
{
}