I am trying to post the following JSON with RestSharp:
{ "username": "test_user", "password": "super$3kretp4ssword" } so this is the c# code i wrote
var client = new RestClient("https://accept.paymobsolutions.com/api/auth/tokens"); var request = new RestRequest(Method.POST); request.AddHeader("content-type", "application/json"); request.AddParameter("application/json", request.AddJsonBody(new { username = "myUsername", password = "myPassword" }), ParameterType.RequestBody); IRestResponse response = client.Execute(request); But on debugging the response.content is ""
The response should be:
{ "token": "ZXlKaGlPaUpJVXpVeE1pSX1Y0NJmV5Sn...", // this is your authentication token "profile": { "id": 28, // this is your merchant_id "user": { "id": 31, "username": "test_user", "first_name": "test_user", "last_name": "test_user", }, "created_at": "2016-11-20T16:27:20.067296Z", ... } } 
responsevariable?responsevariable? Specially theStatusCodefield.responsevariable? Please edit the question to include all the fields and the values they have from theresponsevariable. They might contain information why the request failed. In your case, it looks like it wasn't even send to the server.