REGISTER NOW: Supercharge Your Cloud Integrations and Register for our Webinar on 9/26

Kloudless Blog

Tutorials, case studies and how-tos from our experts

Working with Documents via the PlanGrid API

Stepping into the Construction scene

PlanGrid, the leading construction productivity software, is one of Kloudless’ earliest customers. PlanGrid uses the Kloudless File Explorer to allow contractors to transfer documents and drawings from and to cloud storage services such as Box, Dropbox, Google Drive, and more, using Kloudless’ unified Cloud Storage API. In the recent past, we’ve noticed several additional construction apps begin to use Kloudless for very similar uses. Cloud storage integrations prove valuable since a lot of construction software is centered around document workflow and processes.

However, cloud storage isn’t the only location of valuable documents and files. Kloudless receives numerous inquiries from construction software companies to integrate with other construction software tools. Recently, the number of inquiries proved significant enough that Kloudless decided to step into the construction space and add document data from connectors such as PlanGrid to our Storage API. In this post, we’ll discuss our experience working with the PlanGrid API, obstacles encountered, and how we moved past them.

The PlanGrid API

PlanGrid provides online detailed docs on their API, and has a straightforward process to gain access to a test account to use with their API. This open API approach is crucial to any app’s success today. Apps that encourage developer adoption and mindshare work well with the other software utilities their customers love, making them stickier and more valuable in their customers’ eyes. It’s easy to see why PlanGrid’s rapid growth inspired Autodesk to acquire the company for $875 million!

Accessing files and folders

The Kloudless abstraction layer provides a single interface to access and modify files and folders. Kloudless relies on upstream provider API endpoints to perform these actions. However, the various upstream cloud services may not necessarily provide endpoints with identical functionality. One example of this is accessing folder contents in PlanGrid.

A screenshot of PlanGrid’s web interface displaying its Documents structure.

It is technically possible to create, edit, and delete folders via the PlanGrid web UI. However, a quick review of their API Docs and some tests with API requests revealed that to incorporate PlanGrid’s Documents feature into Kloudless’ File Explorer the same way we had with other major cloud storage systems, we would have to be creative in our use of PlanGrid’s APIs.

Simplifying integration development

One of the core value propositions of the Kloudless layer is to simplify development for our customers and augment the underlying APIs of partner applications where possible. In this scenario, we’d like to offer the same functionality for PlanGrid that Kloudless makes available for API requests to Box.

First, we realized we were able to to construct the entire file/folder tree structure in PlanGrid Documents by listing all files under the whole project, and then filtering out the ones required based on a specific parent folder. In this way, we do the heavy lifting in Kloudless so our customers can expect a smoother experience

Kloudless also simplified the folder creation experience for our integration customers. The PlanGrid API doesn’t explicitly support creating new, empty folders. However, it’s possible to use the File Upload API endpoint to provide a full path to a non-existent location. This indirectly creates a folder, meeting our API’s requirements.

Uploads in PlanGrid

File uploads via the PlanGrid API consist of the three following steps:

  1. A POST request that specifies the project_uid, the content_type of the file (an actual MIME type), the file name, and a folder name.
  2. An actual file upload POST request to the Amazon S3 URL returned from the step above, along with some additional information from that step.
  3. (Optional) A GET request to notify the Plangrid API that the upload is complete. Note that this is usually automatically handled by S3.

Since the PlanGrid API doesn’t provide Folder-related endpoints, it isn’t a surprise that the API only requires a folder name to upload content to rather than a unique ID that identifies an individual folder. If there are multiple identical folders in the “tree”, and a leaf folder name is provided rather than a full path, PlanGrid simply picks the first matching folder via a breadth-first search. A full path name such as first-folder-in-project/folder2/your-file.pdf avoids this ambiguity and also assists with the folder creation mentioned earlier.

Coming Soon: A PlanGrid Connector

Check out Kloudless for a set of standard data models and endpoints to access several different cloud apps with a single integration. Kloudless handles complexities such as the ones described above for PlanGrid for each service we support.

Keep an eye out for our brand new PlanGrid connector that launches this week. The initial release includes support for document data via the Storage API and the File Explorer. We’d love to hear feedback or suggestions at hello@kloudless.com!

Published By

Li-Hsing Chen