Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
120 lines (95 sloc) 4.34 KB
id title layout sectionid permalink prev prevTitle next nextTitle
abc
ABC - Appbase.io via Commandline
docs
abc
abc.html
rest-quickstart.html
REST API - Quickstart
go-quickstart.html
Golang Quickstart

ABC is the commandline interface for working with appbase.io.

Download from github or get the Docker Image.

How It Works

ABC allows creating apps, accessing credentials, viewing usage metrics and importing data from sources like JSON, CSV, MongoDB, SQL into appbase.io. Here is a sneak peek of how it works:

$ abc
USAGE
  abc <command> [flags]

COMMANDS
  login     login into appbase.io
  user      get user details
  apps      display user apps
  app       display app details
  create    create app
  delete    delete app
  logout    logout session
  import    import data to appbase app
  version   show build details
Run 'abc COMMAND --help' for more information on a command.

You can login right from the convenience of the CLI. Once you are logged in, you can check the user info as follows:

$ abc user
NAME:  Siddharth Kothari
EMAIL: siddharth@appbase.io
APPS:
+------+--------------------------+
|  ID  |           NAME           |
+------+--------------------------+
| 7184 | newsave                  |
| 6986 | example-app01            |
...
+------+--------------------------+

Now, let’s try to view the usage metrics of the example-app01 app. (You can also use the app id instead of the app name in the following command.)

$ abc app example-app01 --metrics
ID:         6986
Name:       example-app01
Owner:      siddharth@appbase.io
Users:      siddharth@appbase.io
ES Version: 2.4
Created on: Fri Jul 21 16:05:29 2017

Storage(KB): 3
Records:     1
+-------------+-----------+
|    DATE     | API CALLS |
+-------------+-----------+
| 2017-Jul-21 |     5     |
+-------------+-----------+
|    TOTAL    |     5     |
+-------------+-----------+

The app command also has a flag --creds for viewing the app’s credentials and a flag --data-view to open the app’s data in the data browser.

Finally, let’s create a new app, we will call it abc-demo.

$ abc create abc-demo
(master)
ID:    8499
Name:  abc-demo
Admin API key: 67yS0tlsG:b25979f0-15c4-4c37-ab60-a3e22dcc40a0
Read-only API key: UlSDP7x3r:fc123d3e-1d17-4c66-bffa-d04cbad581a0

Deleting is pretty nifty too with delete, BE CAREFUL as it doesn’t require a confirmation before deleting an app.

$ abc delete abc-demo
App Deleted

Importing Data

Last but not least, the import command allows importing data from sources like Postgres, MongoDB, MySQL, SQL Server, JSON and CSV into your appbase.io app.

Here is an example import command showing data from MySQL being imported to an appbased.io app.

abc import --src_type=mysql --src_uri="USER:PASS@tcp(HOST:PORT)/DBNAME" "https://USER:PASS@scalr.api.appbase.io/APPNAME"

import uses the --src_type and --src_uri switches to set the source database. It takes a required destination URL for the appbase.io app (or Elasticsearch index) into which the data is being imported to. You can follow this step-by-step guide for importing data from MySQL.

Since the import command can do so many things, we have a dedicated post explaining how it works.

Other specific guides:

  1. Importing your MongoDB data
  2. Importing your Postgres data
  3. Importing data from MS SQL
  4. Importing data from one Elasticsearch to another
  5. Importing JSON files
  6. Importing CSV files