Post

Web API libs

  1. If we have only several endpoints for requests - use httpclient, define address, base address, path, query, get a response and deserialize it into model. Pattern https://github.com/dotnet/docs/tree/main/docs/core/extensions/snippets/http

  2. If you need to create API from a controller, use https://github.com/swagger-api/swagger-ui

  3. If you want to simplify code for sending http request, if you want do it simpler than httpclient does, than use https://github.com/restsharp/RestSharp.

  4. if we want to make models based on the existing API. How can we turn jaml into a class? Use https://openapi-generator.tech/docs/generators/csharp.

  5. How to write an interface without manual transformations, but clearly? Try https://www.nuget.org/packages/RestEase.SourceGenerator

  6. If the server is not working yet, but we were given an API and we would like to write the processing code so that everything looks like we are requesting a real server and getting a response. Use https://github.com/WireMock-Net/WireMock.Net

  7. Define query string for each interface field to obtain it and create an object that will automatically create a class for the interface and methods for queries. Use https://www.nuget.org/packages/refit.httpclientfactory

Other

This post is licensed under CC BY 4.0 by the author.