Configurations Endpoints

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:

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

This service has the following endpoints available:

DescriptionEndpoints
Get API Owner's ConfigurationGET /configs
Get Leaf User's ConfigurationGET /configs/{leafUserId}
Create Leaf User's ConfigurationPOST /configs/{leafUserId}
Update API Owner's ConfigurationPATCH /configs
Update Leaf User's ConfigurationPATCH /configs/{leafUserId}
Delete Leaf User's ConfigurationDELETE /configs/{leafUserId}

Endpoints

Get API Owner's Configuration

 GET /configs

Gets the configuration of the API Owner.

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.

{
"apiOwnerUsername": "api-owner",
"leafUserId": "",
"operationsImageCreation": true,
"geoimagesResolution": 0.00001,
"geoimagesShape": "SQUARE",
"geoimagesProjection": "EPSG:3857",
"geoimagesColorRamp": {
"0%": [200, 0, 0],
"35%": [255, 40, 0],
"45%": [255, 150, 0],
"55%": [255, 240, 0],
"65%": [0, 230, 0],
"75%": [0, 190, 0],
"100%": [0, 130, 0],
"nv": [0, 0, 0, 0]
},
"fieldsAutoSync": true,
"fieldsMergeIntersection": 0.01,
"fieldsAttachIntersection": 0.01
}

Get Leaf User's Configuration

 GET configs/{leafUserId}

Gets the configuration of a Leaf User.

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.

{
"apiOwnerUsername": "api-owner",
"leafUserId": "00000000-0000-0000-0000-000000000000",
"operationsImageCreation": true,
"geoimagesResolution": 0.00001,
"geoimagesShape": "SQUARE",
"geoimagesProjection": "EPSG:3857",
"geoimagesColorRamp": {
"0%": [200, 0, 0],
"35%": [255, 40, 0],
"45%": [255, 150, 0],
"55%": [255, 240, 0],
"65%": [0, 230, 0],
"75%": [0, 190, 0],
"100%": [0, 130, 0],
"nv": [0, 0, 0, 0]
},
"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:

{
"operationsImageCreation": true,
"fieldsAutoSync": true
}
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.

{
"apiOwnerUsername": "api-owner",
"leafUserId": "00000000-0000-0000-0000-000000000000",
"operationsImageCreation": true,
"geoimagesResolution": 0.00001,
"geoimagesShape": "SQUARE",
"geoimagesProjection": "EPSG:3857",
"geoimagesColorRamp": {
"0%": [200, 0, 0],
"35%": [255, 40, 0],
"45%": [255, 150, 0],
"55%": [255, 240, 0],
"65%": [0, 230, 0],
"75%": [0, 190, 0],
"100%": [0, 130, 0],
"nv": [0, 0, 0, 0]
},
"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 resquest body must be provided containing the configurations to be set. All entries are optional.

Request body example:

{
"operationsImageCreation": true,
"fieldsAutoSync": true
}
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.

{
"apiOwnerUsername": "api-owner",
"leafUserId": "",
"operationsImageCreation": true,
"geoimagesResolution": 0.00001,
"geoimagesShape": "SQUARE",
"geoimagesProjection": "EPSG:3857",
"geoimagesColorRamp": {
"0%": [200, 0, 0],
"35%": [255, 40, 0],
"45%": [255, 150, 0],
"55%": [255, 240, 0],
"65%": [0, 230, 0],
"75%": [0, 190, 0],
"100%": [0, 130, 0],
"nv": [0, 0, 0, 0]
},
"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:

{
"operationsImageCreation": true,
"fieldsAutoSync": true
}
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.

{
"apiOwnerUsername": "api-owner",
"leafUserId": "00000000-0000-0000-0000-000000000000",
"operationsImageCreation": true,
"geoimagesResolution": 0.00001,
"geoimagesShape": "SQUARE",
"geoimagesProjection": "EPSG:3857",
"geoimagesColorRamp": {
"0%": [200, 0, 0],
"35%": [255, 40, 0],
"45%": [255, 150, 0],
"55%": [255, 240, 0],
"65%": [0, 230, 0],
"75%": [0, 190, 0],
"100%": [0, 130, 0],
"nv": [0, 0, 0, 0]
},
"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.

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}"