Navbar
Logo
 
Docs Home Getting Started Web App API Reference
cURL

Overview

curl -X GET 'https://www.flex.io/api/v1/pipes'
-H "Authorization: Bearer zxcvzxcvzxcvzxcv"

Welcome to the Flexio API!

The Flex.io API allows users to run pipe, configure and manage the running pipe process, and read the resulting pipe process output. Users can set inputs and read outputs so that files can be easily processed with the pipe logic at runtime.

The Flex.io API is organized around REST: pipes, processes, and other resources are accessed with URL endpoints and manipulated using GET, POST, and DELETE HTTP verbs. Results are returned as JSON. Errors are returned using HTTP error codes.

To try out a basic API request that shows your pipes, do the following:

  1. Create an account
  2. Get your API key
    • go to the account area
    • click on the API tab
    • click on “Create API Key”
  3. Create your first API request:
    • create an HTTP GET request for “https://www.flex.io/api/v1/pipes”
    • set the Authorization header to your API key: “Authorization: Bearer :token”

Authentication

curl -X GET 'https://www.flex.io/api/v1/pipes'
-H "Authorization: Bearer zxcvzxcvzxcvzxcv"

API requests must be made over HTTPS and authenticated using an API key. These API keys are located in your user account area under the API section.

API calls are authenticated by passing the API key as a bearer token in the Authorization header:

Authorization: Bearer :token

Errors

Flexio uses standard HTTP response codes for indicating whether a request succeeded or failed. In general, response codes in the 200-level range indicate success, response codes in the 400-level range indicate a failure caused by information provided, and response codes in the 500-level range indicate a failure caused by a problem on the server.

HTTP Status Codes

Code Meaning
200 OK
400 Bad request
401 Unauthorized
403 Forbidden
404 Not found
422 Unprocessable entity
500 Internal server error

Versioning

The API version is included in the HTTP request. The current version is “v1”.

Pagination

Currently, requests returning lists of items will return all the items in the list. We expect to support basic pagination with start and limit parameters soon.

Pipes

Getting a list of pipes

Enter the following to get a list of pipes available to the user:

curl -X GET 'https://www.flex.io/api/v1/pipes'
-H "Authorization: Bearer zxcvzxcvzxcvzxcv"

Running this will return a JSON result similar to the following:

[
    {
        "eid": "dw19t2qccp1h",
        "eid_type": "PIP",
        "eid_status": "A",
        "ename": "",
        "name": "Tech News RSS Aggregator",
        "description": "Technology RSS feed aggregator",
        "project": {
            "eid": "p4vl0rpnj9km",
            "eid_type": "PRJ",
            "name": "Sample Project",
            "description": "Sample project to demonstrate functionality."
        },
        "owned_by": {
            "eid": "h0cdcmy0g0xf",
            "eid_type": "USR",
            "user_name": "john",
            "first_name": "John",
            "last_name": "Bunyan",
            "email_hash": "z191509d24jca1efe5c91e7865ggbf9f"
        },
        "created_by": {
            "eid": "h0cdcmy0g0xf",
            "eid_type": "USR",
            "user_name": "john",
            "first_name": "John",
            "last_name": "Bunyan",
            "email_hash": "z191509d24jca1efe5c91e7865ggbf9f"
        },
        "task": [
            {
                "type": "flexio.input",
                "params": {
                    "location": "http:\/\/feeds.feedburner.com\/TechCrunch\/"
                },
                "metadata": {
                    "connection_type": "http.api"
                },
                "eid": "kv5pqk83231k"
            }
        ],
        "schedule": null,
        "schedule_status": "I",
        "created": "2017-02-10T20:18:26+0000",
        "updated": "2017-03-02T04:41:17+0000"
    }
]

To get a list of all the pipes that a user has access to, use the following API endpoint:

GET http://www.flex.io/v1/pipes

Running this will return an array of pipe objects. Each member in the array will have the following information:

Parameter Type Description
eid string object unique identifier
eid_type string object type
eid_status string object status
ename pipe lookup name
name string pipe name
description string pipe description
project object project that contains the pipe
owned_by object owner of the pipe
created_by object creator of the pipe
task array array of task objects making up the pipe logic
schedule object schedule information for when the pipe will run
schedule_status schedule status indicating whether or not a pipe is scheduled
created string date when the pipe was created
updated string date when the pipe was last updated

Getting a single pipe

curl -X GET 'https://www.flex.io/api/v1/pipes/dw19t2qccp1h'
-H "Authorization: Bearer zxcvzxcvzxcvzxcv"

Running this will return a JSON result similar to the following:

{
    "eid": "dw19t2qccp1h",
    "eid_type": "PIP",
    "eid_status": "A",
    "ename": "",
    "name": "Tech News RSS Aggregator",
    "description": "Technology RSS feed aggregator",
    "project": {
        "eid": "p4vl0rpnj9km",
        "eid_type": "PRJ",
        "name": "Sample Project",
        "description": "Sample project to demonstrate functionality."
    },
    "owned_by": {
        "eid": "h0cdcmy0g0xf",
        "eid_type": "USR",
        "user_name": "john",
        "first_name": "John",
        "last_name": "Bunyan",
        "email_hash": "z191509d24jca1efe5c91e7865ggbf9f"
    },
    "created_by": {
        "eid": "h0cdcmy0g0xf",
        "eid_type": "USR",
        "user_name": "john",
        "first_name": "John",
        "last_name": "Bunyan",
        "email_hash": "z191509d24jca1efe5c91e7865ggbf9f"
    },
    "task": [
        {
            "type": "flexio.input",
            "params": {
                "location": "http:\/\/feeds.feedburner.com\/TechCrunch\/"
            },
            "metadata": {
                "connection_type": "http.api"
            },
            "eid": "kv5pqk83231k"
        }
    ],
    "schedule": null,
    "schedule_status": "I",
    "created": "2017-02-10T20:18:26+0000",
    "updated": "2017-03-02T04:41:17+0000"
}

Accessing information for a single pipe is similar to getting the list of pipes. We simply include the identifier of the pipe we’re interested in on the end of the Pipe API endpoint:

GET http://www.flex.io/v1/pipes/:eid

Running this will return a single pipe object with the following parameters:

Parameter Type Description
eid string object unique identifier
eid_type string object type
eid_status string object status
ename pipe lookup name
name string pipe name
description string pipe description
project object project that contains the pipe
owned_by object owner of the pipe
created_by object creator of the pipe
task array array of task objects making up the pipe logic
schedule object schedule information for when the pipe will run
schedule_status schedule status indicating whether or not a pipe is scheduled
created string date when the pipe was created
updated string date when the pipe was last updated

Command Line Interface

The Flex.io Command Line Interface (CLI) is a tool for managing and running your Flex.io services from the command line. With just one compact utility, you can integrate Flex.io services into your scripts and command-line environment, enabling direct integration with other systems and software.

Installation

Installation with npm

The primary distribution method for the Flex.io CLI on Linux, Windows and Mac OS is npm, a package manager for Node.js that provides an easy way to install, upgrade, and remove Node packages and their dependencies.

Requirements

Assuming you’ve already installed Node.js, you can install the Flex.io CLI with the following command:

$ npm install -g flexio

Installation with pip

If you’re working in a Python environment on Windows, Mac OS, or Linux, you can install the Flex.io CLI using pip.

Requirements

If you have pip and a supported version of Python, you can install the Flex.io CLI with the following command:

$ pip install flexio

Standalone installers

If you use Windows or Linux, the following binary installation packages are available for download:

Configuration

Publically-available pipes can usually be run without any kind of authentication. To access your private pipes, however, you’ll first need to configure the Flex.io command line interface with your API key.

First, retrieve your API key from your account settings page. Log into Flex.io, then click on the “Account” menu item under the user menu found in the upper right-hand corner. On the account page, click on the “API” tab. If you don’t already have an API Key, click the “Create API Key” button. Finally, copy the access code into your cut-and-paste buffer.

At the command line, enter the following:

$ flexio configure

Next, paste your API key and press enter:

$ flexio configure
Configuring profile 'default'
Please enter your API key: wqxvdawcwyrfyjykovjx

Using the flex.io CLI

Listing pipes

To list all pipes for your user:

$ flexio pipes list

Optionally, you can change the output format to JSON:

$ flexio pipes list --output json

Running a pipe

To run a pipe that already has its inputs configured, the syntax is very straight-forward and easy:

$ flexio pipes run pipe-name

In the example above, you would replace the ‘pipe-name’ with your own pipe’s name. If you have access to another user’s pipe and want to run it, you need to qualify the pipe’s name with that user’s id. For example, to run a pipe owned by 'myuser’, you would run something like this:

$ flexio pipes run pipe-name

To send input files to a pipe, simply append one or more files, or a wildcard:

$ flexio pipes run pipe-name file.txt
-or-
$ flexio pipes run pipe-name file.txt *.csv

You can also send the stdin input to a pipe:

$ echo Hello, World | flexio pipes run pipe-name

Many pipes output data. By default, the flexio command line interface does not echo any data. If you want to capture this information, add “–output data”:

$ echo Hello, World | flexio pipes run pipe-name --output data > output.txt

Using multiple configuration profiles

The Flex.io Command Line Interface (CLI) supports multiple configuration profiles, stored in the configuration file. A different profile is useful if you have mulitple users with access to different objects and want to frequently switch back and forth.

To configure an alternate profile, run the following command:

$ flexio configure alternate
Configuring profile 'alternate'
Please enter your API key: yrfyjykovjxwqxvdawcw

To run commands with this alternate profile, simply specify the –profile command line option:

$ flexio pipes list --profile alternate

If no profile is specified, the 'default’ profile is used.

Source code

The source code for the Flex.io CLI is available on Github. You can download or view it here.