This repository contains the command line utility for the API management solution 3scale.net.
To install run the command
npm install -g node-3scale-cli
- 3scale account - sign up for free at http://www.3scale.net
Before using the CLI tool you need to configure it first:
3scale-cli config
[ 3scale-cli ] Please answer the following questions to configure 3scale cli.
? 3scale provider key 1234567890abc
? 3scale id awesome-api
[3scale-cli] 3scale cli tool configured
Your THREESCALE_ID corresponds to the domain of your 3scale admin portal as in THREESCALE_ID-admin.3scale.net
.
The PROVIDER_KEY is the key that identifies you as a 3scale customer. It can be found in the "Account" menu of your 3scale admin portal.
Run this command to update an existing service in your 3scale account and create metrics for each endpoint.
3scale-cli import <spec_type> -f /path/to/apidefinition -s SERVICE_ID
spec_type could be swagger
or raml
SERVICE_ID can be found in your 3scale dashboard.
More options?
-p, --pattern <pattern_type>
specify a pattern for method names, you can use {path}
and {method}
variables in the pattern
for example -p {method}_{path}
will give method with names like GET_/pets
-a, --appplan <applan_name>
create a new application plan
Note: This feature is only accessible to Pro and Entreprise customers
3scale-cli import --type <spec_type> -f /path/to/swagger.json
3cale-cli maprules create -p <pattern> -h <HTTP_VERB> -d <delta> -m <metric_id> -s <service_id>
3cale-cli maprules show -s <service_id> -r <mapping_rule_id> [options]
3cale-cli maprules list -s <service_id> -r <mapping_rule_id> [options]
You can update a specific attribute or all at the same time, possible values:
-p <pattern> -h <HTTP_VERB> -d <delta> -m <metric_id>
3cale-cli maprules delete -s <service_id> -r <mapping_rule_id> [options]
3cale-cli maprules list -s <service_id>
Display the 3scale CLI help with the following command
3cale-cli -help
Usage: 3scale-cli [command] [options]
Commands:
import [options] Import an API from it's API definition (swagger or RAML) into 3scale
config Configure the 3scale cli
app-plan [options] Adds an application plan to a service
metrics [options] Add a new metric to a service.
methods [options] Add a new method to a specific metric on a service
services [options] Create a new service
A command line interface for 3scale API management
Options:
-h, --help output usage information
-V, --version output the version number
3Scale-cli is open source, and we welcome anybody who wants to participate and contribute!
If you want to fix a bug or make any changes, please log an issue in GitHub describing the bug or new feature.
The easiest way to get started with the code is to create your own fork of this repository, and then clone your fork:
$ git clone [email protected]:<you>/3scale-cli.git
$ cd 3scale-cli
$ git remote add upstream git://github.com/3scale/3scale-cli.git
At any time, you can pull changes from the upstream and merge them onto your master:
$ git checkout master # switches to the 'master' branch
$ git pull upstream master # fetches all 'upstream' changes and merges 'upstream/master' onto your 'master' branch
$ git push origin # pushes all the updates to your fork, which should be in-sync with 'upstream'
The general idea is to keep your 'master' branch in-sync with the 'upstream/master'.
If you want to fix a bug or make any changes, please log an issue in GitHub describing the bug or new feature. Then we highly recommend making the changes on a branch named with the issue number. For example, this command creates a branch for the issue #17 :
$ git checkout -b 3scale-cli-issue-17
After you're happy with your changes and a full build (with unit tests) runs successfully, commit your changes on your topic branch. Then it's time to check for and pull any recent changes that were made in the official repository:
$ git checkout master # switches to the 'master' branch
$ git pull upstream master # fetches all 'upstream' changes and merges 'upstream/master' onto your 'master' branch
$ git checkout 3scale-cli-issue-17 # switches to your topic branch
$ git rebase master # reapplies your changes on top of the latest in master
# (i.e., the latest from master will be the new base for your changes)
Push your changes and generate a pull-request
Please try to create one commit per feature or fix, generally the easiest way to do this is via git squash. This makes reverting changes easier, and avoids needlessly polluting the repository history with checkpoint commits.
- NodeJS
$ npm install
$ bin/3scale-api
The MIT License (MIT)
Copyright (c) 2015 3scale Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.