Stara Authentication with Leaf

03 Feb, 2022

Stara Authentication with Leaf

Stara Authentication with Leaf

In this post we are going to talk about integration with Stara starting from creating a developer account to registering the credentials to a user. All endpoints can be found in our docs and Postman collection.

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

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

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 Stara

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

Contact Stara to request access to their API through their email: servicos@stara.com.br; or phone number: +55 054 99706-7292. You will receive 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

Go to Stara developer’s login page at https://developers.stara.com.br/login and use your username and password to log in.

Leaf, data infrastructure for agriculture

Once logged in, your API Key will be displayed in the green field shown in the image below.

Leaf, data infrastructure for agriculture

With this Key you are able to start using the Stara API. Now we’re ready for the next step.

Step 2: Get Your Tokens From Stara

For this step you will need:

  • username
  • password
  • API Key

To get your credential tokens, a POST request can be made to the following endpoint:

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

The request body must include the three attributes previously mentioned:

The tokens can be retrieved in the response of this request:

If you prefer you can use our postman collection to make these calls.

Leaf, data infrastructure for agriculture

With these tokens, we can proceed to the next step.

Step 3: Add Stara 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. Stara Telemetry).

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
  • Here is how you create a Leaf User

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

https://api.withleaf.io/services/usermanagement/api/users/%7ByourLeafUserId%7D/stara-credentials

with the following Header:

and with the following JSON:

Excellent!

Now Leaf will start fetching your farm data from Stara. You can now query Leaf for your standardized 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.

 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