Skip to content

Latest commit

 

History

History
147 lines (102 loc) · 6.54 KB

install.md

File metadata and controls

147 lines (102 loc) · 6.54 KB
title description author ms.author ms.topic date
Install Kiota
Learn how to install Kiota to build API clients.
jasonjoh
jasonjoh
get-started
03/10/2023

Install Kiota

Kiota can be accessed in the following ways.

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

All releases

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 SDK 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.

Execute the following command to install the tool.

dotnet tool install --global Microsoft.OpenApi.Kiota

Build from source

  1. Clone the Kiota repository.

  2. Install the .NET SDK 7.0.

  3. Open the solution with Visual Studio and right click publish --or-- execute the following command:

    dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r <RIDs>
    RIDs 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 if your platform is Windows (x64), your command will be as below

    dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r win-x64
  4. Navigate to the output directory (usually under src/kiota/bin/Release/net7.0).

  5. Run kiota.exe ....

Install the Visual Studio Code extension

  1. Open the Marketplace page of the extension
  2. Click on the Install button.

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 has 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

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 will install Kiota on-demand and will also add 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

  1. 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

  2. Click on the Download button. Restart Visual Studio to complete the installation.

  3. Follow these instructions for generating code.

Next steps

For details on running Kiota, see Using the Kiota tool.