const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/employee-historic', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": {
"id": "<string>",
"employee_id": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"commuting_type": "<string>",
"transport_type": {},
"vehicle_size": {},
"fuel_type": {},
"renewable_energy": {},
"total_km": {},
"weekly_travels": {},
"daily_trips": 123,
"carpool": true,
"situation": "<string>",
"origin": {},
"destination": {},
"response_medium": {},
"co2e": 123,
"created_at": {},
"updated_at": {}
},
"total": 123,
"page": 123,
"size": 123,
"pages": 123
}Retrieve all commuting periods for an employee
const options = {
method: 'GET',
headers: {'x-api-key': '<x-api-key>', 'x-organization-id': '<x-organization-id>'}
};
fetch('https://api.dcycle.io/v1/employee-historic', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"items": {
"id": "<string>",
"employee_id": "<string>",
"start_date": "<string>",
"end_date": "<string>",
"commuting_type": "<string>",
"transport_type": {},
"vehicle_size": {},
"fuel_type": {},
"renewable_energy": {},
"total_km": {},
"weekly_travels": {},
"daily_trips": 123,
"carpool": true,
"situation": "<string>",
"origin": {},
"destination": {},
"response_medium": {},
"co2e": 123,
"created_at": {},
"updated_at": {}
},
"total": 123,
"page": 123,
"size": 123,
"pages": 123
}sk_live_1234567890abcdefa8315ef3-dd50-43f8-b7ce-d839e68d51fa550e8400-e29b-41d4-a716-446655440000150Show Commuting Period Object
in_itinere (home-work) or in_labore (during work)small, medium, largeyes, no, do_not_knowactive, inactive, terminatedmanual, qr, formcurl -X GET "https://api.dcycle.io/v1/employee-historic?employee_id=550e8400-e29b-41d4-a716-446655440000" \
-H "x-api-key: ${DCYCLE_API_KEY}" \
-H "x-organization-id: ${DCYCLE_ORG_ID}"
{
"items": [
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"employee_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-01-01",
"end_date": "2024-06-30",
"commuting_type": "in_itinere",
"transport_type": "car",
"vehicle_size": "medium",
"fuel_type": "petrol",
"renewable_energy": null,
"total_km": 15,
"weekly_travels": [0, 1, 2, 3, 4],
"daily_trips": 1,
"carpool": false,
"situation": "active",
"origin": "Home",
"destination": "Office",
"response_medium": "form",
"co2e": 622.75,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
},
{
"id": "660e8400-e29b-41d4-a716-446655440001",
"employee_id": "550e8400-e29b-41d4-a716-446655440000",
"start_date": "2024-07-01",
"end_date": "2024-12-31",
"commuting_type": "in_itinere",
"transport_type": "train",
"vehicle_size": null,
"fuel_type": "electric",
"renewable_energy": "yes",
"total_km": 15,
"weekly_travels": [0, 1, 2, 3, 4],
"daily_trips": 1,
"carpool": false,
"situation": "active",
"origin": "Home",
"destination": "Office",
"response_medium": "form",
"co2e": 156.20,
"created_at": "2024-07-01T09:00:00Z",
"updated_at": "2024-07-01T09:00:00Z"
}
],
"total": 2,
"page": 1,
"size": 50,
"pages": 1
}
{
"code": "EMPLOYEE_NOT_FOUND",
"detail": "Employee with id=UUID('...') not found"
}