Skip to main content

A command line interface for APIMatic.

Project description

# APIMatic CLI

[![PyPI version](https://badge.fury.io/py/apimatic-cli.svg)](https://badge.fury.io/py/apimatic-cli)
[![Build Status](https://travis-ci.org/apimatic/apimatic-cli.svg?branch=master)](https://travis-ci.org/apimatic/apimatic-cli)

### Overview

This command line tool serves as a wrapper over APIMatic's Python SDK allowing API providers to generate deployment ready SDKs of their APIs for ten platforms using a single command. The following functions are supported:

* Generate an SDK
* Validate an API description
* Transform an API description


### Installation

The quickest way is to install this tool as a package from pip:
```
pip install --upgrade apimatic-cli
```

If you prefer not to use pip, you can install it manually as well:

```
git clone https://github.com/apimatic/apimatic-cli.git
cd apmiatic-cli
python setup.py install
```

Alternatively, you can run this tool without installation:

```
git clone https://github.com/apimatic/apimatic-cli.git
cd apmiatic-cli
pip install -r requirements.txt
```

It's highly recommended to use a [virtual enviroment](http://docs.python-guide.org/en/latest/dev/virtualenvs/) if you choose to go this way.


### Usage

If you installed using pip, you can simply invoke the tool by typing:

```
apimatic-cli -h
```

Otherwise, if you chose not to install, make sure you're in the root folder of the repository and type:

```
python -m apimaticcli -h
```

To use this tool, you have to provide two positional arguments:

* command (generate, validate or transform)
* authentication type (fromapikey, fromuser or fromauthkey)

For information about further required or optional arguments, you can type -h as follows:

```
apimatic-cli generate fromapikey -h
```

### Options

Here is a list of all available options. You're going to be using a subset of these depending on the positional arguments you use.
```
-h or --help Displays the help text and exists.
--api-key The API key of the API description obtained from APIMatic.
--platform The platform for which the SDK needs to be generated. It can be one of:
cs_portable_net_lib, java_eclipse_jre_lib, java_gradle_android_lib,
objc_cocoa_touch_ios_lib, angular_javascript_lib, ruby_generic_lib,
python_generic_lib, php_generic_lib, node_javascript_lib, go_generic_lib
--download-to The path of the folder in which to download the file.
--name The name of the generated SDK.
--email The email address of the user's APIMatic account.
--password The password of the user's APIMatic account.
--auth-key The authentication key of the user's APIMatic account.
--url The URL of the API description.
--file The path of the API description file.
--format The format to convert the API description to. It can be one of:
APIBluePrint, Swagger10, Swagger20, SwaggerYaml, WADL2009, RAML, APIMATIC
--download-as The name (and extension) of the downloaded file.
--skip-unzip Unzipping of downloaded SDKs is skipped if this option is used.
```

### Examples

Generate a C# SDK using an API integretation key:

```
apimatic-cli generate fromapikey --api-key <your key> --platform cs_portable_net_lib --download-to ./SDKs
```

Generate a Python SDK using user credentials and an API description file and skip unzipping:

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

Generate a Ruby SDK using a user authentication key and an API description URL and rename the downloaded SDK:

```
apimatic-cli generate fromauthkey --auth-key <your APIMatic account authentication key> --name TestSDK --url http://www.somewebsite.com/apidescription.json --platform ruby_generic_lib --download-to ./SDKs --download-as CustomName
```

Validate an API description using an API integration key:

```
apimatic-cli validate fromapikey --api-key <your key>
```

Validate an API description using a user authentication key and an API description file:

```
apimatic-cli validate fromauthkey --auth-key <your APIMatic account authentication key> --file ./data/calculator.json
```

Validate an API description using user credentials and an API description URL:

```
apimatic-cli validate fromuser --email <your APIMatic account email> --password <your APIMatic account password> --url http://www.somewebsite.com/apidescription.json
```

Transform an API description to API Blueprint 1A format using an API integretation key:
```
apimatic-cli transform fromapikey --api-key <your key> --format APIBluePrint
```

Transform an API description to APIMatic format using user credentials and an API description file:
```
apimatic-cli transform fromuser --email <your APIMatic account email> --password <your APIMatic account password> --file ./data/calculator.raml --format APIMATIC
```

Transform an API description to Swagger v2.0 (YAML) format using a user authentication key and an API description URL:
```
apimatic-cli transform fromauthkey --auth-key <your APIMatic account authentication key> --url http://www.somewebsite.com/apidescription.json --format SwaggerYaml
```


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apimatic-cli-2.4.tar.gz (17.8 kB view details)

Uploaded Source

Built Distributions

apimatic_cli-2.4-py3-none-any.whl (30.5 kB view details)

Uploaded Python 3

apimatic_cli-2.4-py2.7.egg (66.2 kB view details)

Uploaded Source

File details

Details for the file apimatic-cli-2.4.tar.gz.

File metadata

  • Download URL: apimatic-cli-2.4.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for apimatic-cli-2.4.tar.gz
Algorithm Hash digest
SHA256 8b9e5709c00b8b9fcad1d59557542780f1f3a8130e091b013090b6b3242a70f4
MD5 726f92a20e0b0f953a0462e1470725d3
BLAKE2b-256 fef027097f748ceec1e38ad786e0d5e1809cf3344020b23ef9de236be8149557

See more details on using hashes here.

File details

Details for the file apimatic_cli-2.4-py3-none-any.whl.

File metadata

  • Download URL: apimatic_cli-2.4-py3-none-any.whl
  • Upload date:
  • Size: 30.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.1

File hashes

Hashes for apimatic_cli-2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 c36c477cc5ba2845d9bf918fbf860a5fc81bcf562f826a0c5bae790f274f3d6d
MD5 7fa01a6001cba2d396e8132eb40e8c28
BLAKE2b-256 fb736454ae9e13e9140d1a2727db6c1647aabfed2c29df5d2fc7e032bccb7528

See more details on using hashes here.

File details

Details for the file apimatic_cli-2.4-py2.7.egg.

File metadata

  • Download URL: apimatic_cli-2.4-py2.7.egg
  • Upload date:
  • Size: 66.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.5.2

File hashes

Hashes for apimatic_cli-2.4-py2.7.egg
Algorithm Hash digest
SHA256 9a8f971ce4236fd1f3c3a4d5358894d4d42fec9d06ac3a310634caa394b7db86
MD5 b46758365e348439675b3a8a2bc3a7cb
BLAKE2b-256 fa0fd49228006d41a50664933fffaf0a994dac38f93047bf633df3766eae86c4

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page