HTTP(S) - RestSharp
First Call with RestSharp
PerigeeApplication.ApplicationNoInit("HTTP", (c) => {
//Declare a client, assign the timeout to 10 seconds
using var client = new RestClient(new RestClientOptions("https://postman-echo.com") { MaxTimeout = 10000 });
//Create a request
var req = new RestRequest("/ip", Method.Get);
//Execute
var rsp = client.Execute<postmanEchoIP>(req);
if (rsp.IsSuccessful)
c.GetLogger<Program>().LogInformation("Response [{code}]: {ip}", (int)rsp.StatusCode, rsp.Data?.ip ?? "");
else
c.GetLogger<Program>().LogInformation("Response [{code}]: {content}", (int)rsp.StatusCode, rsp.Content);
});
public class postmanEchoIP { public string ip { get; set; } }Authentication
Authentication with Perigee Credentials
Extensions
Execute Retry
IsTimeout
Last updated

