Hello,
I test this url https://api.matchbook.com/bpapi/rest/security/session with a POST and a JSON in the body containing my credentials and it works fine, i get as a result a nice JSON like this (i deleted some values in there)
{
“session-token”: “”,
“user-id”: 159754,
“role”: “USER”,
“account”: {
“email”: “”,
“username”: “”,
“balance”: 0,
“exposure”: -0.00000505,
“language”: “English”,
“address”: {
“country”: {
“country-id”: 52,
“name”: “”,
“country-code”: “CUR”
},
“address-id”: 110199,
“address-line-1”: “”,
“address-line-2”: “”,
“post-code”: “”
},
“currency”: “EUR”,
“id”: 756412,
“name”: {
“title”: “Mr”,
“first”: “”,
“last”: “”,
“title-id”: “”
},
“date-of-birth”: “”,
“phone-number”: “”,
“free-funds”: 0.00067,
“commission-credit”: 0,
“language-id”: 1,
“currency-id”: 2,
“odds-type-id”: “DECIMAL”,
“odds-type”: “DECIMAL”,
“bet-confirmation”: false,
“display-p-and-l”: true,
“exchange-type-id”: “BACKLAY”,
“exchange-type”: “back-lay”,
“odds-rounding”: true,
“user-security-question”: {
“user-security-question-id”: 71730,
“question”: {
“security-question-id”: 5,
“security-question”: “”
},
“answer”: “”
},
“bet-slip-pinned”: true
},
“last-login”: “2018-04-24T22:22:41.000Z”
}
This is cool until i click on code as i look for c# code and i’m given
var client = new RestClient(“https://api.matchbook.com/bpapi/rest/security/session”);
var request = new RestRequest(Method.POST);
request.AddHeader(“Postman-Token”, “dcd363f4-f088-4a3a-b754-fec2272700e9”);
request.AddHeader(“Cache-Control”, “no-cache”);
request.AddHeader(“Content-Type”, “application/json”);
request.AddParameter(“undefined”, “{\r\n “username”: “UserNameValue”,\r\n “password”: “PasswordValue”\r\n}”, ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
This code works but result is not JSON. It looks like this
“{“session-token”:“136170_9f977dd3f0bdac1459296b50e3604b”,“user-id”:458762,“role”:“USER”,“account”:{“email”:“[email protected]”,“username”:“UserNameValue”,“balance”:0.00,“exposure”:-0.00000505,“language”:“English”,“address”:{“country”:{“country-id”:52,“name”:“okokok”,“country-code”:“CUR”},“address-id”:110199,“address-line-1”:“Dr. M.J Hugenholtzweg”,“address-line-2”:“Z/H. UTS- Gebouw”,“post-code”:“12341234”},“currency”:“EUR”,“id”:754123,“name”:{“title”:“Mr”,“first”:“Asian”,“last”:“Connect NV”,“title-id”:“MR”},“date-of-birth”:“1980-01-01T05:00:00.000Z”,“phone-number”:“1324123411”,“free-funds”:0.00067000,“commission-credit”:0E-8,“language-id”:1,“currency-id”:2,“odds-type-id”:“DECIMAL”,“odds-type”:“DECIMAL”,“bet-confirmation”:false,“display-p-and-l”:true,“exchange-type-id”:“BACKLAY”,“exchange-type”:“back-lay”,“odds-rounding”:true,“user-security-question”:{“user-security-question-id”:71730,“question”:{“security-question-id”:5,“security-question”:“question”},“answer”:“answer”},“bet-slip-pinned”:true},“last-login”:“2018-04-24T22:46:54.000Z”}”
So the related c# code does not reflect what postman itself get as a result.
Where is the JSON content? ie What do change in the code? or how to ask postman for the correct c# code?