Form of a John Deere Credentials resource:
Copy {
"status" : "str" ,
"clientKey" : "str" ,
"clientSecret" : "str" ,
"tokenId" : "str" ,
"tokenSecretKey" : "str" ,
"accessToken" : "str" ,
"refreshToken" : "str"
}
Endpoints
John Deere Credentials Endpoints# Get the John Deere credentials# Â GET /users/{leafUserId}/john-deere-credentials
Get the John Deere credentials of the Leaf User based on its id and returns a JSON with the credentials. If during background processing we detect that this credential is no longer valid, the value of the status will be changed.
Request examples# Copy curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/john-deere-credentials'
Response# Copy {
"clientKey" : "str" ,
"clientSecret" : "str" ,
"tokenId" : "str" ,
"tokenSecretKey" : "str" ,
"accessToken" : "str" ,
"refreshToken" : "str" ,
"status" : "str" ,
"clientEnvironment" : "STAGE or PRODUCTION"
}
Create a John Deere credentials# Â POST /users/{leafUserId}/john-deere-credentials
Create a John Deere credentials for the Leaf User.
Request examples# Copy {
"clientKey" : "str" ,
"clientSecret" : "str" ,
"accessToken" : "str" ,
"refreshToken" : "str" ,
"clientEnvironment" : "STAGE or PRODUCTION"
}
Copy curl -X POST \
-H 'Authorization: Bearer YOUR_TOKEN' \
-d '{"clientKey": "str","clientSecret": "str","accessToken": "str","refreshToken": "str","clientEnvironment": "STAGE or PRODUCTION"}' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/john-deere-credentials'
Response# A John Deere credentials with status.
Copy {
"clientKey" : "str" ,
"clientSecret" : "str" ,
"tokenId" : "str" ,
"tokenSecretKey" : "str" ,
"accessToken" : "str" ,
"refreshToken" : "str" ,
"status" : "str" ,
"clientEnvironment" : "STAGE or PRODUCTION"
}
Delete John Deere credentials# Â POST /users/{leafUserId}/john-deere-credentials
Delete Leaf User's John Deere credentials.
Request examples# Copy curl -X DELETE \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/john-deere-credentials'
One-click authentication# This is a new, simpler and faster alternative to using John Deere credentials on Leaf API.
 POST /users/{leafUserId}/one-click-integration/JohnDeere
Get the URL for simplified one-click authentication with John Deere.
Request examples# Copy {
"clientKey" : "str" ,
"clientSecret" : "str" ,
"clientEnvironment" : "STAGE or PRODUCTION"
}
Copy curl -X GET \
-H 'Authorization: Bearer YOUR_TOKEN' \
'https://api.withleaf.io/services/usermanagement/api/users/{leafUserId}/one-click-integration/JohnDeere'
-d '{"clientKey": "str", "clientSecret": "str", "clientEnvironment": "STAGE or PRODUCTION"}' \
Response# Copy {
"signInUrl" : "https://signin.johndeere.com/oauth2/aus...1t7/v1/authorize?response_type=code&client_id=0oa...d83&redirect_uri=https%3A%2F%2Fapi.agrigate.io%2Fservices%2Fusermanagement%2Fapi%2Fusers%2Fone-click-integration%2FJohnDeere%2Fcallback&scope=ag1+ag2+eq1+eq2+files+openid+profile+email+address+phone+offline_access&state=Naq...7Ow"
}
Once the consent is given all the other steps to assign the credential to the Leaf user is automated and a reply will be received saying the process was completed successfully:
Copy {
"status" : "CREDENTIAL_ASSIGNED" ,
"message" : "JD Credential assigned to Leaf User" ,
"connectedOrganizations" : [
{
"id" : "509991" ,
"name" : "Connections Testing" ,
"managementUri" : "https://connections.deere.com/connections/0oa...5d7/connections-dialog?orgId=509991"
}
] ,
"notConnectedOrganizations" : [
{
"id" : "509992" ,
"name" : "Leaf Agriculture" ,
"managementUri" : "https://connections.deere.com/connections/0oa...5d7/select-organizations"
}
]
}