Stara Authentication with Leaf

03 Feb, 2022

Stara Authentication with Leaf

Stara Authentication with Leaf

In this tutorial we are going to talk about integration with Stara starting from creating a developer account to registering the credentials to a Leaf User. By the end, you will have set up an integration with Stara via Leaf to access standardized machinery data; with the Stara integration, you will be able to access field names, field boundaries, planting operations, as-applied operations and machine information. Endpoints can be found in our docs and Postman collection.

(Clique aqui para a tradução em português)


Did you know the quickest and simplest way to enable provider authentication is through Magic Link or Leaf Link? Leaf provides pre-built widgets (Leaf Link) and shareable URLS (Magic Link) so you can save time on building UI. Talk to us to learn more about pricing.

Summary

  • Step 0: Create a developer account with Stara
  • Step 1: Get your API Key from Stara
  • Step 2: Get your tokens from Stara
  • Step 3: Add Stara credentials to Leaf

Step 0: Create A Developer Account With Stara

(If you already have a developer account in Stara, you can skip this step.)

To create your developer account, please contact Stara at servicos@stara.com.br; or by phone at +55 054 99706-7292 and request access to their API. Stara will provide you with a username and password.

Once you have those, you can go to the next step of this tutorial.

Step 1: Get Your API Key From Stara

To retrieve your API key, you will do a POST:

https://v2apitelemetria.telemetriastara.com.br/autenticacao

With the following body:

The response, will be:

Now that you have your API key, you can use this to get your tokens in the next step.

Step 2: Get Your Tokens From Stara

In this step, the endpoint will generate the necessary access and refresh tokens for all other requests on Stara's API. To retrieve your tokens, you will do a POST:

https://v2apitelemetria.telemetriastara.com.br/token

With the following body:

The response, will be:

Step 3: Add Stara Credentials to Leaf

When you integrate with a provider via Leaf, you'll need to create something called a 'Leaf User', which is used to manage provider authentication and organize data for your end users. 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. Stara Telemetry).

To send your credentials to Leaf, you will need your access token from Leaf, and have already created a Leaf User.

Here is how you get your access token.
Here is how you create a Leaf User.

To add your Stara credentials to the Leaf User you created, send a POST to:

https://api.withleaf.io/services/usermanagement/api/users/{ {leaf_user_id} }/stara-credentials

with the following Header:

and with the following JSON:

Excellent! Now that you've connected the credentials to Leaf, you can start querying data from Stara. We recommend starting with field boundaries if you haven't already got boundaries in place.

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.

 Leaf | Data infrastructure for agriculture

Guthierry Almeida

Product Owner

Guthierry Almeida, originally from Espírito Santo, Brazil, is Product Owner for Leaf Agriculture. He has worked with product management and has a vast experience with GIS. Also, he has in-depth knowledge in precision agriculture, and is passionate about forest research and ESG.

Connect with me

Ready to begin?

Get API Keys and Start Building Today!

Sign up for free account

Questions? Get in touch