Building third-party apps with Pantacor Hub API

With Pantacor Hub, you can share and deploy apps and device state with other devices or team members in the Pantacor Hub device ecosystem.  In addition to this off the shelf capability, there is also a third-party service API available that allows you to connect with other applications, or even build your own functionality into Pantacor Hub.

The API opens up a whole world of possibilities of what can be done within the Pantacor Hub ecosystem. With the API, you can easily connect to open source projects like Kubernetes, MongoDB, Elastic, Prometheus and Grafana.  In a future post, we’ll show you how to connect to and manage IoT data with some of these open source and cloud native apps. In this post, we’ll show you how to add new functionality with a user interface to Pantacor Hub.  The example we’re using is the  open source project Dolly

What is the Dolly project?

Dolly is a web application that enables you to copy device states, platforms, or configurations from one device to another. It provides a UI that allows you to input one device as the source that can be used to updates other devices. The source device may be owned by you or it can also be any other public device.

General workflow for building apps in Pantacor Hub 

This is the workflow for building an application and displaying it in the Pantacor Hub platform through the API:

  1. Create a Pantacor Hub account
  2. Create the application inside your Pantacor Hub account
  3. Get familiar with our platform, it’s API and how Pantavisor and the hub work together.
  4. Authenticate a user with Pantacor Hub OAuth service
  5. Use the user token to communicate with the API.

Log in with (or Create) your Pantacor Hub account

This could be as simple as going to and creating or logging into Pantacor Hub. You can also log in with a preferred OAuth provider like Google, Github, or Gitlab.

Connect the application to Pantacor Hub

In order to use our OAuth Provider and gain access to proper permissions for your application’s user, you need to first set up the application on Pantacor Hub.

When creating a new application, fill in the following: 

  • Name: this one is self-explanatory
  • Type: the application type could be Public or Confidential, and this refers to the grant types inside the OAuth specification. We accept those which have an “Authorization Code” (confidential type) or “Implicit” (public type)
  • Reading scopes: A list of scopes you want to use from the user. Those start from reading user’s information as the minimal amount of data you can get, and from there you have read/write devices, read/write trails , and complete access.
  • Callback URL whitelist: List of permitted callbacks URLs used by the OAuth provider.

Getting to know the Pantacor platform and its API

Pantacor solves the problem of building, managing and maintaining embedded Linux systems and their applications. In addition to this, the platform solves the problem of building and running an efficient and portable system that fits onto low-spec devices with minimal resources.

It does this with the following products:

  • Pantavisor Linux – an open source framework for building and managing portable and containerized embedded Linux systems. Pantavisor also has a tiny footprint of 1MB with strict build rules and can be used in any Linux device, from single-core NAND/NOR flash class devices to Raspberry Pis. If it’s Linux, Pantavisor runs on it.
  • Pantacor Hub – a web-based SaaS (software as a service) product with a UI that allows embedded teams to deploy, manage and share embedded system states built with Pantavisor Linux. It behaves much like a traditional software repository and includes state revisions (or trails and steps) with the ability to roll a device state forward and backward or select a specific state and deploy it to a device or a fleet of devices.

To get a sense of how Pantacor Hub and Pantavisor work, we also have a detailed post on How Pantacor Hub and Pantavisor work together.  Learn about the API in our documentation, or you could just read the swagger documentation

Authenticate the user using Pantacor Hub OAuth service

Pantacor Hub is an OAuth provider like any other, therefore you will just need to use the authorization window to create a new token for your application.

This is an example URL of how to ask for permissions using OAuth: 

  • APP_PRN: is the one you have on the application detail
  • CALLBACK_URL: One of the available callback URLs for your application
  • RESPONSE_TYPE: Type of response you expect to receive from the OAuth provider, options are [token, code]. Using token as type will return the token as an implicit URL, which means {CALLBACK_URL}#token=TOKEN_STRING in other cases will return a code that needs to be exchanged by using it in the login endpoint and using the CLIENT_ID and CLIENT_SECRET

Use the user token to communicate with the API

With the user token, you can use it to communicate with the API on behalf of the user.

Now you’re ready to build your own application and connect it to Pantacor Hub. You can take a look at the Dolly source code that allows you to move entire systems from one device to another.


Happy trailing!