Endpoints

About

All HTTP methods should be prepended by this service's endpoint:

https://api.withleaf.io/services/usermanagement/api

See below the REST resources and their endpoints available in this service.

Leaf Users Resources

Form of a Leaf User resource:

{
"id": "UUID",
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str",
"trimbleCredentials": {"Object"},
"cnhiCredentials": {"Object"},
"johnDeereCredentials": {"Object"},
"ravenCredentials": {"Object"},
"climateFieldViewCredentials": {"Object"},
"staraCredentials": {"Object"},
"agLeaderCredentials": {"Object"},
"ravenSlingshotCredentials": {"Object"}
}

Check the providers credentials endpoints for more details about the credentials object.

The following endpoints are available:

DescriptionEndpoints
Get a Leaf UserGET /users/{id}
Get all Leaf UsersGET /users/
Create a Leaf UserPOST /users
Update a Leaf UserPUT /users
Delete a Leaf UserDELETE /users/{id}

User Endpoints

Get a Leaf User

 GET /users/{id}

Get a Leaf User by its id.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{id}'

Response

A Leaf User as a JSON object.

{
"id": "UUID",
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str",
"trimbleCredentials": {"Object"},
"cnhiCredentials": {"Object"},
"johnDeereCredentials": {"Object"},
"ravenCredentials": {"Object"},
"climateFieldViewCredentials": {"Object"},
"staraCredentials": {"Object"},
"agLeaderCredentials": {"Object"},
"ravenSlingshotCredentials": {"Object"}
}

Get all Leaf Users

 GET /users

Get all Leaf Users.

Request examples

curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users'

Response

A JSON array containing Leaf Users.

Create a Leaf User

 POST /users

Creates a Leaf User.

Request example

{
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str"
}

Besides the four properties of the example above, if you already have created credentials for some provider like John Deere, you can add an entry like the following, specifying the id of the credentials object previously created, so it will be bind to the Leaf User being created. Check the providers credentials endpoints for more details about the credentials object.

"johnDeereCredentials": {
"id": "UUID"
}
curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{ "name": "str", "email": "help@withleaf.io", "phone": "str", "address": "str"}' \
'https://api.withleaf.io/services/usermanagement/api/users'

Response

A Leaf User with the id assigned to it and it's credentials.

{
"id": "UUID",
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str"
}

Update a Leaf User

 PUT /users

Edits an existing Leaf User by submitting a new one.

Request examples

{
"id": "UUID",
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str"
}

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 like this:

"johnDeereCredentials": {
"id": "UUID"
}

Check the providers credentials endpoints for more details about the credentials object.

curl -X PUT \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{ "id": "UUID", name": "str", "email": "help@withleaf.io", "phone": "str", "address": "str"}' \
'https://api.withleaf.io/services/usermanagement/api/users'

Response

A Leaf User with the id assigned to it and it's credentials.

{
"id": "UUID",
"name": "str",
"email": "help@withleaf.io",
"phone": "str",
"address": "str"
}

Delete a Leaf User

 DELETE /users/{id}

Deletes an existing Leaf User by id.

Request examples

curl -X DELETE \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{id}'

Providers credentials endpoints

tip

Please don't hesitate to contact us to schedule a demo, ask a question, request sample data, or suggest a feature!