You can create a client SDK from APIs registered on API Center using Visual Studio Code. This section will guide you through the integration process.
To use this feature, you need to install the API Center extension in Visual Studio Code. In addition to that, you may be asked to install the Microsoft Kiota extension.
-
Open the API Center extension, navigate down to the API definition, and right-mouse click on the API definition. Then choose the "Generate API Client" option.
-
When the pop-up modal appears, click the "Open" button.
-
When the Kiota extension opens, make sure that everything is selected and click the
▶️ button to generate an API client. -
The prompt asks several questions in the order. Enter the following values:
- Choose a name for the client class 👉
PetStoreClient
- Choose a name for the client class namespace 👉
WebApp.ApiClients
- Enter an output path relative to the root of the project 👉
dotnet/src/WebApp/ApiClients
- Pick a language 👉
CSharp - stable
- Choose a name for the client class 👉
-
After the client is generated, you can see the client class in the specified output path.
-
Copy some codes to make the client SDK work.
# Bash ./infra/scripts/copy-files.sh # PowerShell ./infra/scripts/Copy-Files.ps1
-
Run the following command to run the web application.
dotnet watch run --project dotnet/src/WebApp