
In this post, we will show you how easily we can follow the authorization routine on AgFiniti, the AgLeader platform software. From here, we will be retrieving data and get the necessary permissions to access your farm data with Leaf.
(Clique aqui para a tradução em português)
Summary
- Step 0: Create your AgFiniti account;
- Step 1: Get your AgLeader developer credentials;
- Step 2: Get your AgLeader tokens;
- Step 3: Create a Leaf User with AgLeader credentials on Leaf;
These steps are a full walkthrough. Once you follow the necessary steps you will not need to repeat them for subsequent calls.
Step 0: Create a developer account with AgLeader
(This step can be skipped if you already have an account in AgLeader, otherwise, you should follow the instructions below).
To create a new account on the AgFiniti just click on this link.
After you have created your developer account, you can follow the next step of this tutorial.
Step 1: Get your AgLeader developer credentials
First of all, make sure to log in to your AgLeader account, with the following URL https://www.agfiniti.com/Home/Welcome, and click in the white forward arrow inside an orange circle.

Next, access the “Consumer Keys” tab and save the Public and Private Key. We will be using both later.
You can also confirm all the operation data related to your account by accessing the Mappable Data tab from the Resources icon in the profile scroll list. We will present a sample of one of these files processed via Leaf later.
.jpg?auto=format&w=1200)
Step 2: Get your AgLeader tokens
In this next step, we are going to use the /authorize URL to retrieve the Bearer Token (Access Token) and the Refresh Token. For that, we are going to set parameters that will allow us to configure the type of permissions on our account.
Here is an example of how it should look:
https://www.agfiniti.com/api/oauth2/authorize?response_type=code&client_id= _your_Public_ Key_ &scope=openid%20profile%20email%20filedownload
After filling the URL properly with your Public Key, you will be redirected to a page where will be able to retrieve your Access Token and Refresh Token.
.jpg?auto=format&w=1200)
Step 3: Create a Leaf User with AgLeader credentials on Leaf
Leaf’s API must then be initiated with AgLeader credentials in order to access the data from your user’s AgFiniti account. After creating a Leaf User and adding these credentials to the Leaf User, their files will be standardized and available for retrieval in a few minutes.
1. Create a Leaf User
POST to
https://api.withleaf.io/services/usermanagement/api/users/
with the following Header: Authorization: Bearer
2. Add AgLeader Credentials to your Leaf User
POST to
https://api.withleaf.io/services/usermanagement/api/users//ag-leader-credentials
with the following Header: Authorization: Bearer
and with the following JSON as the request payload:
3. Get all files from that Leaf User
GET to
https://api.withleaf.io/services/operations/api/files?leafUserId=&provider=AgLeader
with the following Header: Authorization: Bearer
Good Job!
Here we can see next, a sample of a Leaf file processed response.
Leaf will pull all the files from your user’s AgFiniti account and in a matter of minutes, you will be able to retrieve your data.