Payment method trying to get authenticatation with restsharp

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Below is my code to post to rest api as below

curl https://www.billplz.com/api/v3/bills \
  -u 73eb57f0-7d4e-42b9-a544-aeac6e4b0f81: \
  -d collection_id=inbmmepb \

            
RestClient client = new RestClient("https://www.billplz.com");
            RestRequest request = new RestRequest("/api/v3/bills", Method.POST);
            request.AddHeader("collection_id", strColId);
            request.AddHeader("Authorization", "Basic " + strApiKey + ":");
            
            request.AddParameter("email", email);
            request.AddParameter("name", name);
            request.AddParameter("amount", amount);
            request.AddParameter("callback_url", callback_url);


But nothing happens
6 years ago
[email protected] wrote:
Below is my code to post to rest api as below

curl https://www.billplz.com/api/v3/bills \
  -u 73eb57f0-7d4e-42b9-a544-aeac6e4b0f81: \
  -d collection_id=inbmmepb \

            
RestClient client = new RestClient("https://www.billplz.com");
            RestRequest request = new RestRequest("/api/v3/bills", Method.POST);
            request.AddHeader("collection_id", strColId);
            request.AddHeader("Authorization", "Basic " + strApiKey + ":");
            
            request.AddParameter("email", email);
            request.AddParameter("name", name);
            request.AddParameter("amount", amount);
            request.AddParameter("callback_url", callback_url);


But nothing happens



Did you executed your request? like

IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string
6 years ago
forefront wrote:


Did you executed your request? like

IRestResponse response = client.Execute(request);
var content = response.Content; // raw content as string


Of course i did, it just nothing happened. Didn't even redirect the request to the url
Even log is empty not notifying anything.
6 years ago
[email protected] wrote:


Of course i did, it just nothing happened. Didn't even redirect the request to the url
Even log is empty not notifying anything.


It will not redirect to anywhere its rest API it will work in background. Can you debug and check what response you got in response object?
6 years ago
forefront wrote:


It will not redirect to anywhere its rest API it will work in background. Can you debug and check what response you got in response object?

This is the error

Could not load type 'RestSharp.Authenticators.HttpBasicAuthenticator' from assembly 'RestSharp, Version=105.0.1.0, Culture=neutral, PublicKeyToken=null'
6 years ago
[email protected] wrote:


This is the error

Could not load type 'RestSharp.Authenticators.HttpBasicAuthenticator' from assembly 'RestSharp, Version=105.0.1.0, Culture=neutral, PublicKeyToken=null'


Right. So error clearly saying RestSharp assembly not loaded with require version(105.0.1.0)

So check your RestSharp assembly version in reference. If old version or not there then To install RestSharp, run the following command in the Package Manager Console.
Install-Package RestSharp -Version 105.0.1.0


Thanks,
Jatin
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.