我正在运行以下代码:
var client = new RestClient();
var request = new RestRequest("https://connect.squareup.com/v1/me/payments", Method.GET)
{
RequestFormat = DataFormat.Json
};
request.AddHeader("Authorization", "Bearer XXXXXX");
var Response = client.Execute(request);
响应错误消息指出:
Value cannot be null.
Parameter name: uri
不确定我为什么会收到此错误
答案 0 :(得分:1)
我目前无法尝试此操作,因此我不确定它是否是您正在寻找的解决方案,但这只是一个想法:尝试使用Uri字符串初始化RestClient
,RestRequest
包含其余字符串,或者使用空字符串,如下所示:
var client = new RestClient("https://connect.squareup.com/v1/me/payments");
var request = new RestRequest("", Method.GET)
{
RequestFormat = DataFormat.Json
};
request.AddHeader("Authorization", "Bearer XXXXXX");
var Response = client.Execute(request);