Install Kiota
Kiota can be accessed in the following ways.
- Download binaries
- Run in Docker
- Install as .NET tool
- Build from source
- Install the Visual Studio Code extension (preview)
- Run in GitHub Actions (preview)
- Install with asdf (UNOFFICIAL)
- Install with Homebrew (UNOFFICIAL)
- REST API Client Code Generator extension for Visual Studio (UNOFFICIAL)
Download binaries
You can download the latest version for your operating system.
Operating system | Download |
---|---|
Linux (x64) | linux-x64.zip |
macOS (arm64) | osx-arm64.zip |
macOS (x64) | osx-x64.zip |
Windows (x64) | win-x64.zip |
Windows (x86) | win-x86.zip |
Run in Docker
You can run Kiota in our Docker container with one of the following commands.
docker run -v /some/output/path:/app/output \
-v /some/input/description.yml:/app/openapi.yml \
mcr.microsoft.com/openapi/kiota generate --language csharp -n namespace-prefix
Tip
You can alternatively use the --openapi
parameter with a URI instead of volume mapping.
To generate a client library from an online OpenAPI description and into the current directory:
docker run -v ${PWD}:/app/output mcr.microsoft.com/openapi/kiota \
generate --language typescript -n gfx -d \
https://raw.githubusercontent.com/microsoftgraph/msgraph-sdk-powershell/dev/openApiDocs/v1.0/Mail.yml
Install as .NET tool
If you have the .NET SDK installed, you can install Kiota as a .NET tool.
To install the tool, execute the following command.
dotnet tool install --global Microsoft.OpenApi.Kiota
Build from source
Clone the Kiota repository.
Install the .NET SDK 8.0.
Open the solution with Visual Studio and right select publish or execute the following command:
dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r <runtime-identifiers>
Runtime identifier Value Linux (x64) linux-x64 macOS (arm64) osx-arm64 macOS (x64) osx-x64 Windows (x64) win-x64 Windows (x86) win-x86 Note
Refer to .NET runtime identifier catalog so select the appropriate runtime for your platform.
For example, the following command builds for Windows (x64).
dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r win-x64
Navigate to the output directory (usually under
src/kiota/bin/Release/net7.0
).Run
kiota.exe ...
.
Install the Visual Studio Code extension
- Open the Marketplace page of the extension
- Select on the Install button.
Note
The Kiota Visual Studio Code extension is currently in public preview and is subject to change.
Run in GitHub actions
You can use the setup Kiota GitHub Action in your workflow to automate client refresh and more by adding a reference to it in your workflow definition and using the CLI just like you would locally.
steps:
- uses: actions/checkout@v3
- uses: microsoft/setup-kiota@v0.5.0
- name: Update kiota clients in the repository
run: kiota update -o . # for a complete documentation of the CLI commands see https://aka.ms/kiota/docs
working-directory: src # assumes client is under the src path in your repository
Note
The setup Kiota GitHub Action in public preview and is subject to change.
Install with asdf
Important
The asdf Kiota plugin is maintained and distributed by the community and is not an official Microsoft plugin. Microsoft makes no warranties, express or implied, with respect to the plugin or its use. Use of this plugin is at your own risk. Microsoft shall not be liable for any damages arising out of or in connection with the use of this plugin.
The community made Kiota available as an asdf plugin. To install the asdf-kiota
plugin, follow these instructions:
asdf plugin add kiota
# or
asdf plugin add kiota https://github.com/asdf-community/asdf-kiota.git
# Show all installable versions
asdf list-all kiota
# Install specific version
asdf install kiota latest
# Set a version globally (on your ~/.tool-versions file)
asdf global kiota latest
# Now kiota commands are available
kiota --version
Install with Homebrew
Important
The Homebrew formula for Kiota is maintained and distributed by the community and is not an official Microsoft plugin. Microsoft makes no warranties, express or implied, with respect to the plugin or its use. Use of this plugin is at your own risk. Microsoft shall not be liable for any damages arising out of or in connection with the use of this plugin.
The community made Kiota available as a Homebrew formula for macOS running on x64 and arm64 architectures. To install, follow these instructions:
brew install kiota
REST API Client Code Generator
Important
The REST API Client Code Generator extension for Visual Studio is maintained and distributed by the community and is not an official Microsoft Visual Studio extension. Microsoft makes no warranties, express or implied, with respect to the extension or its use. Use of this extension is at your own risk. Microsoft shall not be liable for any damages arising out of or in connection with the use of this extension.
REST API Client Code Generator is a collection of Visual Studio C# custom tool code generators for OpenAPI specifications. This extension installs Kiota on-demand and adds the required NuGet packages to build the generated code to the project. The generated code is created as a "code-behind" file to the OpenAPI specifications file in the .NET project. This extension offers same-day releases for new Kiota versions, but this requires updating the extension, which can be configured to be automatically.
Installation
From Visual Studio (Windows), using the Manage Extensions dialog box (Tools -> Manage Extensions), search for extension called REST API Client Code Generator. This extension is available for Visual Studio 2022 for AMD64 and ARM64 and Visual Studio 2019
Note
For Visual Studio for Mac, follow these instructions
Select on the Download button. To complete the installation, restart Visual Studio.
Follow these instructions for generating code.
Next steps
For details on running Kiota, see Using the Kiota tool.