Leaf User Endpoints
About
To briefly recap the Leaf User overview: a Leaf User is equivalent to the end user of your application (e.g. a grower). A Leaf User provides a way to keep your customers' data organized under your API owner. As a developer, you’ll need to create a Leaf User and connect the provider(s) you wish to integrate your platform with.
All HTTP methods should be prepended by this service's endpoint:
See below the REST resources and their endpoints available in this service.
Leaf Users Resources
Form of a Leaf User resource:
Check the providers credentials endpoints for more details about the credentials object.
The following endpoints are available:
Description | Endpoints |
---|---|
Get all Leaf Users | GET /users/ |
Get a Leaf User | GET /users/{id} |
Create a Leaf User | POST /users |
Update a Leaf User | PUT /users |
Delete a Leaf User | DELETE /users/{id} |
User Endpoints
Get all Leaf Users
 GET /users
Get all Leaf Users.
Request examples
- cURL
- Python
- JavaScript
Response
Check the providers credentials endpoints for more details about the credentials object.
Get a Leaf User
 GET /users/{id}
Get a Leaf User by its id
. This request looks up an individual Leaf User (such as a grower) and returns the details associated with their account, including provider credentials such as ID, created date and tokens.
Request examples
- cURL
- Python
- JavaScript
Response
Create a Leaf User
 POST /users
Creates a Leaf User. You will need to create a Leaf User when linking a provider for the first time.
Request body
The optional externalId
property can be informed to identify the Leaf User with an existing user ID, facilitating matching between Leaf and the client application.
Besides the four properties of the example above, once you have created credentials for a provider like John Deere, you can add an entry like the following. Specifying the ID of the credentials object previously created will link it to the Leaf User being created. This will enable you to start querying farm data from the provider. Check the providers credentials endpoints for more details about the credentials object.
Request examples
- cURL
- Python
- JavaScript
Response
Update a Leaf User
 PUT /users
Edits an existing Leaf User by submitting a new one.
Request body
Note that if the existing resource has credentials and you don't include them in the body, the new Leaf User will have no credentials. Said that, for keeping the credentials or updating them, include in the JSON above an entry. Check the providers credentials endpoints for more details about the credentials object.
Request examples
- cURL
- Python
- JavaScript
Response
Delete a Leaf User
 DELETE /users/{id}
Deletes an existing Leaf User by id
.
Request examples
- cURL
- Python
- JavaScript
Providers credentials endpoints
After connecting with a provider, a summary of the available resources can be accessed using the Integration resource endpoint.
tip
Please don't hesitate to contact us at help@withleaf.io to schedule a demo, ask a question, request sample data, or suggest a feature!