March 16th, 2023

Tailored SDK experiences via Kiota now generally available

We’re happy to announce Kiota, our code generator for HTTP APIs described by OpenAPI, is available to all developers who want to focus on calling APIs in a consistent, robust and reliable way, without having to worry about the messy details of constructing HTTP requests. It is an open-source project, built on GitHub.

This release delivers a set of improvements as stated in the release notes. If you want to learn more about Kiota, read our full documentation.

What is Kiota?

Kiota is a command line tool for generating an API client to call any OpenAPI described API you are interested in. Kiota helps eliminate the need to take a dependency on a different API client for every API that you need to call, as well as limiting the generation to the exact API surface area you’re interested in, thanks to a filtering capability. Kiota API clients provide a strongly typed experience with features you’d expect from a high-quality API client (simple, reliable, secure and scalable), but without having to learn a new library for every HTTP API. It also provides embedded support for retry handling, secure redirects, transparent authentication and automatic payload compression.

Installation options

We have options to install Kiota. The easiest way would be to use our dotnet tool and install it globally on your environment. It’s as simple as running a single command and you will be able to generate client libraries in no time!

https://gist.github.com/sebastienlevert/c9147719cd0fd36f934a1a15e8cc4a0c

If you want to discover other ways to install Kiota (e.g., web, docker, build, etc.), review the getting started guide.

Using the tool

The first thing you will want to do with Kiota is search for APIs. To achieve this, using the Kiota search command will help identify and choose the right API for your business scenario.

https://gist.github.com/sebastienlevert/e7689e54b235f8c76150c00c8357e748

Once you have identified the API to use, use that location with the parameter –openapi to visualize the API structure with the Kiota show command. This will give you confidence in the surface area that you want to generate for your client library. You can specify which paths you want to include by using the include glob pattern –include-path.

https://gist.github.com/sebastienlevert/a9e760e7b422da46ecd3b6ecd2d9c8b4

You are now only a command away to be able to leverage a rich client library experience. To generate your client library, use the kiota generate command.

https://gist.github.com/sebastienlevert/1cc15522f90015b68b04d54dcab3d94c

Using a Kiota generated client

You can now use the Kiota generated client in your application using standardized API patterns.

https://gist.github.com/sebastienlevert/527b2abdfa3b8cdd2558691788794cd4

Try out the new version today!

We’re excited about this release and can’t wait for you to try it out. We look forward to hearing from you about your experience with the tool and how we can continue to make Kiota even better.

Resources

Happy coding!

Author

Rabeb Othmani
Senior Product Manager
Sébastien Levert
Senior Product Manager

Sebastien is a Senior Product Manager on the Microsoft Graph Developer Experiences team where he is focusing on Kiota, the Microsoft Graph Toolkit and the Microsoft Graph SDKs.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Dan B

    Nice. Will definitely give it a try. How does it compare with AutoRest (also by Microsoft), NSWag and OpenAPI Generator?

    Amazon also comes up with something called Smithy but I don’t like it.

  • Michael Taylor

    I said it on the related blog post about using Kiota and I'll say it here, Kiota is an interesting experiment but honestly I cannot imagine anyone using it directly outside perhaps MS with the Graph API. As a OpenAPI client generator it pushes too much of the OpenAPI stuff up to clients such that using it directly in your code would be a bad idea. For example `client.findUser` is far more readable than `client.users.postasync`. That is sort of the whole purpose of operationIds in my opinion. You're basically exposing the HTTP protocol to callers instead of wrapping them cleanly....

    Read more