Tutorial

Trimble Authentication with Leaf

How to connect with Trimble via Leaf



Leaf’s API is the easiest way to build with farm data.

Software developers use Leaf’s API to build and scale a wide range of products including farm optimization tools, lending products, outcome-based financing, land and input marketplaces, agronomic recommendations, traceability applications, equipment maintenance forecasting, and more.

Here is a link to Leaf’s website.

At Leaf, we’re empowering developers working on food and farm problems. It begins with API access
to field boundaries, precision agriculture data, and advanced satellite imagery.

In this post, we are going to show you how to easily go through Trimble’s authorization flow with Leaf, that is, get authorized to access your users’ Trimble data with Leaf. We’ll be making some calls to Leaf, all endpoints can be found in our docs and Postman collection. Let's get to it!

Summary

  • Step 0: Create a developer account with Trimble
  • Step 1: Get your Application Name and Service Identity Id
  • Step 2: Add Trimble credentials to Leaf

Keep in mind that this tutorial is a full walkthrough. Most of the steps presented will be done only once, meaning that subsequent calls will be much easier and faster.

Step 0: Create a developer account with Trimble

(if you already have a developer account in Trimble, you can skip this step)

Creating a Trimble developer account is a very simple and automatic process, just register with this link.

After that, you will have created your developer account and can go to the next step of this tutorial.

Step 1: Get your Application Name and Service Identity Id

At the end of this step, you want to have retrieved:

  • your Application Name and Service Identity Id

First, you have to login in your Trimble developer account.
To do this, go to https://agdeveloper.trimble.com/,
click Join (top right corner) and log in.

Under Trimble Ag Software Integration, select Request API:

This will redirect you to a form to request Trimble access to the Trimble Ag Software API’s. In the field Data to be Sent to Trimble Ag Software, specify that no data is needed, since Leaf only receives data from Trimble. In the field Data to be Received from Trimble Ag Software, write “Organizations, Files, Clients, Fields, Farms and Devices”.

 Fill the remaining fields of the form according to your use case. Trimble will contact you shortly to provide your Application Name and Service Identity Id.

Step 2: Add Trimble credentials to Leaf

Leaf’s API uses an abstraction called Leaf User to store credentials and organize data for each individual data owner. In most cases, the Leaf User will be the farmer or consultant that has access to the source data inside the machinery company’s FMIS (e.g. Trimble Connected Farm).

Leaf’s API must then be initiated with Trimble credentials in order to access and standardize Trimble data. To send your credentials to Leaf, you will need your access token from Leaf, and have already created a Leaf User. If you don’t know how to do that, here is how you get your access token, and here is how you create a Leaf User.

note: the same Leaf User can be attached to many providers, so you can query data for that Leaf User from all the providers they have data at the same time.

Now, attach your credentials to the Leaf User you created. Send a POST to

https://api.withleaf.io/services/usermanagement/api/users/yourLeafUserId/trimble-credentials 

with the following Header

and with the following JSON

Excellent!

Now Leaf will start fetching your farm data from Trimble. You can now query Leaf for your standardized data.

See ya!

Similar posts

Stay in the loop with all of Leaf's future insights, technical updates and latest case studies.

Subscribe to receive our monthly newsletter and newest blog posts with industry leading insights, company updates and more.