About# Here we list all the available endpoints from Leaf's Configuration API. To call them easily, we recommend using Leaf's Postman collection .
All HTTP methods should be prepended by this service's endpoint:
Copy https://api.withleaf.io/services/config/api
This service has the following endpoints available:
Endpoints# Get API Owner's Configuration# Â GET /configs
Gets the configuration of the API Owner.
Copy TOKEN = YOUR_TOKEN
curl -X GET \
-H "Authorization: Bearer ${TOKEN} " \
"https://api.withleaf.io/services/config/api/configs"
Response# A JSON containing the configuration of the API Owner.
Copy {
"apiOwnerUsername" : "api-owner" ,
"leafUserId" : "" ,
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"fieldsMergeIntersection" : 0.01 ,
"fieldsAttachIntersection" : 0.01 ,
"cleanupStandardGeojson" : true ,
"cleanupRules" : {
"wetMass" : [
{ "operator" : "GT" , "value" : 0.0 }
] ,
"harvestMoisture" : [
{ "operator" : "GT" , "value" : 0.0 } ,
{ "operator" : "LT" , "value" : 100.0 }
] ,
"recordingStatus" : [
{ "operator" : "EQ" , "value" : "On" }
]
}
}
Get Leaf User's Configuration# Â GET configs/{leafUserId}
Gets the configuration of a Leaf User.
Copy TOKEN = YOUR_TOKEN
LEAF_USER_ID = 00000000-0000-0000-0000-000000000000
curl -X GET \
-H "Authorization: Bearer ${TOKEN} " \
"https://api.withleaf.io/services/config/api/configs/ ${LEAF_USER_ID} "
Response# A JSON containing the configuration of the Leaf User.
Copy {
"apiOwnerUsername" : "api-owner" ,
"leafUserId" : "00000000-0000-0000-0000-000000000000" ,
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"fieldsMergeIntersection" : 0.01 ,
"fieldsAttachIntersection" : 0.01 ,
"fieldsAutoMerge" : true
}
Create Leaf User's Configuration# Â POST /configs/{leafUserId}
Creates the Configuration for the Leaf User leafUserId. A request body must be provided
containing the configurations to be set. All entries are optional, any missing configuration will be inherited from the API Owner's Configuration.
Request body example:
Copy {
"operationsImageCreation" : true ,
"fieldsAutoSync" : true
}
Copy TOKEN = YOUR_TOKEN
LEAF_USER_ID = 00000000-0000-0000-0000-000000000000
curl -X POST \
-H "Authorization: Bearer ${TOKEN} " \
-H "Content-Type: application/json" \
-d '{ "operationsImageCreation": true, "fieldsAutoSync": true }' \
"https://api.withleaf.io/services/config/api/configs/ ${LEAF_USER_ID} "
Response# A JSON containing the configuration of the Leaf User.
Copy {
"apiOwnerUsername" : "api-owner" ,
"leafUserId" : "00000000-0000-0000-0000-000000000000" ,
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"fieldsMergeIntersection" : 0.01 ,
"fieldsAttachIntersection" : 0.01 ,
"fieldsAutoMerge" : true
}
Update API Owner's Configuration# Â PATCH /configs
Updates the specified fields of Configuration for the API Owner. A request body must be provided
containing the configurations to be set. All entries are optional.
Request body example:
Copy {
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"cleanupRules" : {
"wetMass" : [
{ "operator" : "GT" , "value" : 0.0 }
] ,
"harvestMoisture" : [
{ "operator" : "GT" , "value" : 0.0 } ,
{ "operator" : "LT" , "value" : 100.0 }
] ,
"recordingStatus" : [
{ "operator" : "EQ" , "value" : "On" }
]
}
}
Copy TOKEN = 'YOUR_TOKEN'
curl -X PATCH \
-H "Authorization: Bearer ${TOKEN} " \
-H "Content-Type: application/json" \
-d '{ "operationsImageCreation": true, "fieldsAutoSync": true }' \
'https://api.withleaf.io/services/config/api/configs'
Response# A JSON containing the configuration of the API Owner.
Copy {
"apiOwnerUsername" : "api-owner" ,
"leafUserId" : "" ,
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"fieldsMergeIntersection" : 0.01 ,
"fieldsAttachIntersection" : 0.01 ,
"fieldsAutoMerge" : true
}
Update Leaf User's Configuration# Â PATCH /configs/{leafUserId}
Updates the specified fields of Configuration for the Leaf User leafUserId. A resquest body must be provided containing the configurations to be set. All entries are optional.
Request body example:
Copy {
"operationsImageCreation" : true ,
"fieldsAutoSync" : true
}
Copy TOKEN = YOUR_TOKEN
LEAF_USER_ID = 00000000-0000-0000-0000-000000000000
curl -X PATCH \
-H "Authorization: Bearer ${TOKEN} " \
-H "Content-Type: application/json" \
-d '{ "operationsImageCreation": true, "fieldsAutoSync": true }' \
"https://api.withleaf.io/services/config/api/configs/ ${LEAF_USER_ID} "
Response# A JSON containing the configuration of the Leaf User.
Copy {
"apiOwnerUsername" : "api-owner" ,
"leafUserId" : "00000000-0000-0000-0000-000000000000" ,
"operationsImageCreation" : true ,
"fieldsAutoSync" : true ,
"fieldsMergeIntersection" : 0.01 ,
"fieldsAttachIntersection" : 0.01 ,
"fieldsAutoMerge" : true
}
Delete Leaf User's Configuration# Â DELETE /configs/{leafUserId}
Deletes the Configuration from the Leaf User leafUserId. Until a new Configuration is created, the Leaf User will inherit all configurations from the API Owner.
Copy TOKEN = YOUR_TOKEN
LEAF_USER_ID = 00000000-0000-0000-0000-000000000000
curl -X DELETE \
-H "Authorization: Bearer ${TOKEN} " \
"https://api.withleaf.io/services/config/api/configs/ ${LEAF_USER_ID} "