What are folks doing these days to make REST API calls from dotnet/C#? Are you using something like RestSharp, the HttpClient + Newtonsoft JSON[.]NET, or something else?
@reverentgeek HttpClient is pretty much all you need. System.Text.Json also does an amazing job, not external dependency required.
@reverentgeek No need for Newtonsoft these days.
@reverentgeek This is mine, but even though this is the thinnest of the ones you mentioned, I'm still finding ways to use HttpClient that are safer and with less ceremony than RestClient .net Hope to put them in a library some day github.com/MelbourneDevel…
@reverentgeek HTTP client (factory) + system.text.json
@reverentgeek no one should be using newtonsoft really at this point unless you have some legacy code it's STJ + httpclient all the way Httpclient also supported typed clients, which is super useful milanjovanovic.tech/blog/the-right…
@reverentgeek HttpClient + System.Text.Json (there are built-in methods so you don't need to serialize/deserialize manually).
@reverentgeek System.text.json, no need for external dependence on newtonsoft. Httpclient. And lately using kiota generated client with script to spin up webapi to get swagger json.
@reverentgeek Refit + the built in System.Text.Json serializer support + HttpClientFactory + Microsoft.Extensions.Resilience
@reverentgeek Flurl.Http (flurl.dev) Extremely easy to use, very powerful just out-of-the-box.
@reverentgeek Switched to Microsoft Kiota because it was one of the few options that was AOT compatible and uses System.Text.Json.
@reverentgeek @FlurlHttp is very simple and great for what I need. They also updated it to use System.Text.Json (I think you can still use Newtonsoft though).
@reverentgeek HttpClient for small for small interfaces, github.com/canton7/RestEa… for bigger or more complex interfaces.
@reverentgeek More extended and resilient client (based on Refit) : github.com/Respawnsive/Ap…
@reverentgeek Why would i use Newtonsoft JSON in 2024? If there's an OpenAPI specification i'd use a source generator such as NSwag with System.Text.Json and DI support. If there's no spec i'd go with Refit. It automagically generates the implementation to a given interface. Give it a try.
@reverentgeek Restsharp || (HttpClient && (System.Text.Json || Newtonsoft.Json))
@reverentgeek We used NSwag last time I was on a team doing this. I don't know if that was a bad choice or if it is out of date, but it worked just fine for us.
@reverentgeek HttpClient is what I use if a nuget package doesn’t exist which does the work itself
@reverentgeek HttpClient + System.Text.json Mainly to prevent use of external dependencies which is pain when writing plugins for Dataverse.
@reverentgeek Minimal API's, no need for any 3rd party tools any more in modern .NET, it's all built into the box.
@reverentgeek Restsharp. Use case: corporate dev, data import via APIs from EXEs called during batch imports.
@reverentgeek HTTP client factory + .net built-in JSON class Best of both worlds 😁
@reverentgeek Refit actually, it basically generates the implementation based on an interface
@reverentgeek HttpClient + Polly. HttpClientFactory to instantiate. System.Text.Json under the hood via HttpClientExtensions.