A large number of our users describe their APIs using our API editor and generate SDKs from our website. But there is an equally large niche of our users who prefer using our CodeGen API to generate SDKs or our Transformer API to transform their API descriptions. We set out with the goal of making the lives of these API users easier and came up with the APIMatic CLI.
APIMatic CLI is a command line tool written in Python which serves as a wrapper over our own Python SDK. It is available in the form of a small windows executable so you can easily plug it into your build cycle. You no longer have to write your own code or set up a development environment for the consumption of our APIs.
The APIMatic CLI will create the API request for you, call the API and download the generated SDK or the converted API description. It even supports unzipping of zipped SDK files. It allows multiple authentication methods and supports all the features of our APIs i.e. SDK generation, API validation and API transformation. You can provide an API description in multiple ways to it as well. It supports API integration keys from APIMatic, API description files from URLs and also allows you to upload API descriptions from your computer.
Getting started with the APIMatic CLI is very easy. Let’s take you through a few different methods of installation and show you some examples of its usage.
Installing APIMatic CLI
Since the APIMatic CLI is written in Python, you have multiple installation options. If you don’t have Python installed, the simplest way to go would be to just download the executable fromhere and run it. If you have Python installed, you can use pip to install the APIMatic CLI. Alternatively, you can install it manually or even directly run the code itself. You can check out the documentation on our Github page for clear instructions.
If you have installed APIMatic CLI using pip, you can start using it by typing:
Command (generate, validate or transform) and authentication (fromkey or fromuser) are the two positional arguments that have to be provided in order to use this tool. There is a whole list of options available for you to build your commands depending on the positional arguments you choose.
Now, for instance, you want to generate a C# SDK using an API integration key, all you need to type is:
apimatic-cli generate fromkey — api-key <your key> — platform cs_portable_net_lib — download-to ./SDKs
Similarly, if you want to generate a python SDK using user credentials and an API description file while skipping the unzipping part, you can write the following command line:
apimatic-cli generate fromuser — email <your APIMatic account email> — password <your APIMatic account password> — name TestSDK — file ./data/calculator.json — platform python_generic_lib — download-to ./SDKs — skip-unzip
In this way, whatever functions you’d want to perform, all you’ll need to do is type a command on your CLI and that’s it. I hope this article provides sufficient information regarding APIMatic CLI and its usage. For more information, you can always check it out onGitHub where complete documentation is provided.