Question

I have to call the following URL using RestSharp. Some part of the uri are not standard. How can I get to use them in

The url is the following but without the white space: http:// mysite.com/api/v2.php?method = information :: method&token=b&target_id=0

I've tried something like this but RestSharp is not calling the URL I was expecting to call.

var client2 = new RestClient("http:// mysite.com/api/v2.php");
var request = new RestRequest("method=information::method", Method.GET);
request.AddParameter("token", authenticationToken);
request.AddParameter("target_id", targetId);
Était-ce utile?

La solution

You don't mention what url your code actually calls, but I guess that your method is parsed as a file/path, and not a parameter.

var client = new RestClient("http:// mysite.com/api/");
var request = new RestRequest("v2.php", Method.GET);
request.AddParameter("method", "information::method");
request.AddParameter("token", authenticationToken);
request.AddParameter("target_id", targetId);
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top