Currently, there are almost 50 plugins written for connecting Mitto to various APIs (Salesforce, Netsuite, etc), databases, and flat files. Most of these plugins are created and maintained by Zuar as either part of base Mitto or premium plugin subscriptions.

If you have a custom API or a data source Mitto doesn't currently have a plugin for, it is possible to write your own Mitto plugin in Python.

We've added a sample custom Mitto plugin, written to connect to the sample API at reqres.in. This plugin can read and interpret data from the users endpoint.

Here's the Mitto plugin for ReqRes in Github: https://github.com/zuarbase/mitto-plugin-reqres

Adding this plugin to Mitto is easy using just a few command line jobs to download and install the plugin. Once the plugin is installed you can create a Mitto job that uses it.

Download the Plugin

The first Mitto job we create will clone the git repo onto Mitto's file system. This job will only be run once (running it twice would cause a "folder exists" error).

Since the mitto-plugin-reqres repo is publicly available we can just clone the repo using HTTP (we won't have to add any ssh or deploy keys). If your custom plugin is stored in a private repo, you would need to upload your key to Mitto's filesystem, and run another command line job to add the key and change the permissions

Cloning a Private Github Repo on Mitto
Whether you have a repository of CSV files, command line scripts, or a customMitto plugin, cloning a private Github repo onto your Mitto will require alittle setup. We recommend cloning the repo over SSH using a deploy key. To do this, you willneed to upload your SSH key to the Mitto filesystem…

In the Mitto UI, we click the Add Job button in the bottom left-hand corner of the page. Select Command as the job type. When prompted in the wizard add a job name, and use the command:

git clone https://github.com/zuarbase/mitto-plugin-reqres.git /var/mitto/data/mitto-plugin-reqres
clone public repo wizard configuration
clone public repo wizard configuration

Running the job clones the repo on our Mitto inside /var/mitto/data/.

Install the Plugin on Mitto

Any plugin Mitto finds in /var/mitto/plugin is usable via Mitto jobs.

The second job we create will create a sym link to the Python file in our plugin repo in /var/mitto/plugins. The python package is the file named reqres.py shown below:

tree output of reqres repo
Tree output of ReqRes repo

Once again, create a command line job using the Add Job wizard. This time when prompted, use the following command:

ln -s /var/mitto/data/mitto-plugin-reqres/reqres.py /var/mitto/plugin/reqres.py

Use the Plugin with a Mitto Job

Finally, we create a job that uses our custom plugin. Using the Add Job wizard we select Generic Job as the job type. We give the job a name, select io as the job type, and then enter the following JSON:

{
    "input": {
        "endpoint": "users",
        "use": "reqres#ReqResInput"
    },
    "output": {
        "dbo": "postgresql://localhost/analytics",
        "schema": "reqres",
        "tablename": "users",
        "use": "call:mitto.iov2.db#todb"
    },
    "steps": [
        {
            "transforms": [
                {
                    "use": "mitto.iov2.transform#ExtraColumnsTransform"
                },
                {
                    "use": "mitto.iov2.transform#ColumnsTransform"
                }
            ],
            "use": "mitto.iov2.steps#Input"
        },
        {
            "use": "mitto.iov2.steps#CreateTable"
        },
        {
            "transforms": [
                {
                    "use": "mitto.iov2.transform#FlattenTransform"
                }
            ],
            "use": "mitto.iov2.steps#Output"
        },
        {
            "use": "mitto.iov2.steps#CollectMeta"
        }
    ]
}

Running the job will hit the users endpoint at https://reqres.in/api/users and write the data to the table reqres.users in Mitto's internal PostgreSQL database analytics.

ReqRes user data
ReqRes user data

See Mitto's help documentation here.

Subscribe to the Community to receive the latest Mitto developments.

Read more Mitto-related articles.