JDaniels57
JDaniels57

Reputation: 13

RestRequest and Square Connect

I am running the following code:

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);

The response error message states:

Value cannot be null.
Parameter name: uri

Not sure why I'm getting this error

Upvotes: 0

Views: 391

Answers (1)

Boris
Boris

Reputation: 389

I cannot try this currently, so I'm not sure it will be the fix you are looking for, but it's just a thought: try to initialize the RestClient with the Uri string, and the RestRequest with the rest of the string, or with empty string, like this:

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);

Upvotes: 1

Related Questions