Beta > Machines Endpoints
About
All HTTP methods should be prepended by this service's endpoint:
See below the REST resources and their endpoints available in this service.
Machines (BETA)
Machine Resources
This feature has the following endpoints available:
Description | Endpoints |
---|---|
Get all machines | GET /users/{leafUserId}/machines |
Create a machine | POST /users/{leafUserId}/machines |
Get a machine | GET /users/{leafUserId}/machines/{machineId} |
Get machine files | PATCH /users/{leafUserId}/machines/{machineId}/files |
Delete a machine | DELETE /users/{leafUserId}/machines/{machineId} |
Update a machine | PATCH /users/{leafUserId}/machines/{machineId} |
Get all machines
 GET /users/{leafUserId}/machines
Get the list of machines that are related to a given LeafUserId. Some fields can be sent as query parameters to filter the machines, such as:
Parameter (to filter by) | Values |
---|---|
name | text |
provider | text (JohnDeere, CaseIH, Stara, etc) |
providerOrganizationId | text |
serialNumber | text |
originType | specify the origin of the machine, must be either USER_CREATED, FILE_POOLED or PROVIDER_POOLED |
createdTime | must match exactly the time of the record creation, ISO 8601 without timezone |
beforeCreatedTime | filters for records created before the datetime, ISO 8601 without timezone |
afterCreatedTime | filters for records created after the datetime, ISO 8601 without timezone |
vin | filters machines by Vehicle Identification Number |
You can also pass some parameters used exclusively for paging through results. They are:
page
, an integer specifying the page being fetched (default is 0)size
, an integer specifying the size of the page (max is 100)sort
, the sorting order of the results; can be multi-value, where the first value to be passed will have preference in ordering over the next ones; you can also specify the order asasc
ordesc
withasc
being the default. Example: id, desc- Valid values for sorting are: id, leafUserId, name, provider, providerOrganizationId, providerMachineId, serialNumber, vin, model, make, category
For more request examples see Leaf Postman collection
- cURL
- Python
- JavaScript
Response
The response is a JSON array containing machine records.
Create a machine
 POST /users/{leafUserId}/machines
Creates a machine for a specific LeafUser.
Request body
- cURL
- Python
- JavaScript
Response
A new machine is assigned to the given LeafUserId.
Get a machine
 GET /api/users/{leafUserId}/machines/{machineId}
Get the details of a given machine by its id.
- cURL
- Python
- JavaScript
Response
A machine record with more details.
Get machine files
 GET /api/users/{leafUserId}/machines/{machineId}/files
Get the details of machine operations files given a machine id. Some fields can be sent as query parameters to filter the machine files, such as:
Parameter (to filter by) | Values |
---|---|
leafFileId | UUID |
originType | specify the origin of the machine, must be either USER_CREATED, FILE_POOLED or PROVIDER_POOLED |
createdTime | an ISO 8601 without timezone specifying the operation exact created time |
beforeCreatedTime | filters for records created before the datetime, ISO 8601 without timezone |
afterCreatedTime | filters for records created after the datetime, ISO 8601 without timezone |
startTime | must match exactly the time of the start of the operation, ISO 8601 without timezone |
endTime | must match exactly the time of the end of the operation, ISO 8601 without timezone |
beforeStartTime | an ISO 8601 without timezone, returns all operations that started before the specified time |
afterStartTime | an ISO 8601 without timezone, returns all operations that started after the specified time |
beforeEndTime | an ISO 8601 without timezone, returns all operations that ended before the specified time |
afterEndTime | an ISO 8601 without timezone, returns all operations that ended after the specified time |
distanceValue | a double value for the distance |
greaterThanDistanceValue | a double value for the distance, returns all operations that have a distance value greater than the specified distance |
lessThanDistanceValue | a double value for the distance, returns all operations that have a distance value lesser than the specified distance |
distanceUnit | must be "Mile", "mile", "Feet" or "ft" |
You can also pass some parameters used exclusively for paging through results. They are:
page
, an integer specifying the page being fetched (default is 0)size
, an integer specifying the size of the page (max is 100)sort
, the sorting order of the results; can be multi-value, where the first value to be passed will have preference in ordering over the next ones; you can also specify the order asasc
ordesc
withasc
being the default. Example: id, desc- Valid values for sorting are: id, leafUserId, machineId, startTime, endTime, createdTime, leafFileId
For more request examples see Leaf Postman collection
- cURL
- Python
- JavaScript
Response
A json array containing the machine operations files details.
Delete a machine
 DELETE /api/users/{leafUserId}/machines/{machineId}
Delete a machine data
Only machines created by the user can be Deleted
Machine data obtained from providers cannot be deleted
- cURL
- Python
- JavaScript
Update a machine
 PATCH /api/users/{leafUserId}/machines/{machineId}
Update a machine for a specific LeafUser.
Only machines created by the user can be updated
Machine data obtained from providers cannot be updated
- cURL
- Python
- JavaScript