0

We have created a new API project using .NET Core 6 and create some API controllers. For that, how can we create an API client library for this project to consume the API?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • What's the actual question? You already used the tags of the tools used for this. Have you tried something and run into problems? Have you checked the [code generation docs](https://learn.microsoft.com/en-us/aspnet/core/tutorials/getting-started-with-nswag?view=aspnetcore-6.0&tabs=visual-studio#code-generation) ? – Panagiotis Kanavos Sep 15 '22 at 13:48
  • you want to creat MVC or Angular or React clients? https://learn.microsoft.com/en-us/aspnet/web-api/overview/advanced/calling-a-web-api-from-a-net-client – Laxmikant Sep 15 '22 at 19:15

1 Answers1

0

If I am Not wrong, You meant to create a API client Library, which we can consume at an Web API project!

For this, At first Create a class Library project with the required implementation of API client. Refer - Creating a .Net Library project

Integration onto Web API Project-

local setup - Build the class library and once done, in the Web API -> Add project dependencies / references of the class library or add .dll file(You can find this in bin folder).

Resolve dependencies of class Library in Web project if any and consume the api client.

Advanced - cloud setup - publish it to artifactory and you can consume it via nugget package