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);
有帮助吗?

解决方案

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);
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top