Approves expense. If params of the expense are present, updates the expense before approval
Disapprove expense with a comment
| Param name | Description |
|---|---|
|
comment
optional |
The reason of expense disapproval; will be displayed to user Validations:
|
Get the list of all trips accessible by the current user. Can be paginated and/or filtered by trip state
GET /api/trips
200
[
{
"id": 1,
"description": "MyText",
"_id": "trip-1",
"user_name": "Wellington Nikolaus IV",
"state": "queue",
"user_id": 4,
"type": "trip",
"updated_at": "2021-05-26T20:11:19.064Z",
"cost_center_ids": [],
"date": "2021-05-26",
"approvers": [],
"approved_by": null,
"approved_by_ids": [],
"current_approvers_ids": [],
"transaction_approvers": [],
"created_at": "2021-05-26T20:11:19.064Z",
"company_id": 2,
"paid_at": null,
"taxable": 1.0,
"mileage_vehicle_id": 1,
"cost_center_id": 0,
"user": {
"id": 4,
"name": "Wellington Nikolaus IV",
"email": "quinten@bernhardward.name",
"country": {
"id": 2,
"name": "quam exercitationem a",
"currency": "EUR",
"currency_symbol": "€"
}
},
"cost_centers": [],
"comments": [],
"entries": [
{
"id": 1,
"trip_transaction_id": 1,
"distance": 10.0,
"number_of_people": "1",
"cost_cents": 100,
"cost_currency": "EUR",
"original_amount_cents": 100,
"original_amount_currency": "EUR",
"route": null,
"emissions": "16.6639"
}
],
"vehicle": {
"id": 1,
"name": "id",
"country": {
"id": 3,
"name": "et dolores ut",
"currency": "EUR",
"created_at": "2021-05-26T20:11:18.944Z",
"updated_at": "2021-05-26T20:11:18.944Z",
"code": null
},
"years": [
{
"id": 1,
"year": 2021,
"cost_cents": "10.0",
"additional_passenger_cents": "0.0"
}
]
},
"documents": []
}
]
| Param name | Description |
|---|---|
|
archived_after
optional |
Return only trips accounted on and after the supplied date. Date format: YYYYMMDD (example: 20180702) Validations:
|
|
page
optional |
Return only one page of trips. Default per-page is 10 Validations:
|
|
per_page
optional |
Number of trips returned per page. Works only in combination with “page” param. Default value is 10 Validations:
|
|
state
optional |
Validations:
|
Creates a new trip.
POST /api/trips
{
"state": "draft",
"date": "2021-05-26",
"user_id": 1,
"company_id": 17,
"mileage_vehicle_id": 9,
"currency": "EUR",
"original_currency": "EUR",
"description": "Test trip",
"cost_center_ids": [
691
],
"entries_attributes": [
{
"number_of_people": "John Smith",
"distance": "300"
},
{
"number_of_people": "1",
"distance": "200",
"waypoints_attributtes": [
{
"position": 0,
"address": "Amsterdam",
"latitude": 52.3675734,
"longitude": 4.9041389
},
{
"position": 1,
"address": "The Hague",
"latitude": 52.0704978,
"longitude": 4.3006999
}
]
}
]
}
201
{
"id": 115,
"description": "Test trip",
"_id": "trip-115",
"user_name": "HackH",
"state": "queue",
"user_id": 1,
"type": "trip",
"updated_at": "2021-05-26T20:28:21.257Z",
"cost_center_ids": [
691
],
"date": "2021-05-26",
"approvers": [],
"approved_by": [],
"approved_by_ids": [],
"current_approvers_ids": [],
"transaction_approvers": [],
"created_at": "2021-05-26T20:28:21.257Z",
"company_id": 17,
"paid_at": null,
"taxable": 135.0,
"mileage_vehicle_id": 9,
"cost_center_id": 0,
"user": {
"id": 1,
"name": "HackH",
"email": "buru@hack.com",
"country": {
"id": 3,
"name": "Sweden",
"currency": "SEK",
"currency_symbol": "kr"
}
},
"cost_centers": [
{
"id": 691,
"name": "Ololo CC",
"dimension_name": "Cost Center",
"assignee_ids": [],
"deactivated": false,
"external_id": "”06”",
"approvers": []
}
],
"comments": [],
"entries": [
{
"id": 118,
"trip_transaction_id": 115,
"distance": 300.0,
"number_of_people": "John Smith",
"cost_cents": 13500,
"cost_currency": "EUR",
"original_amount_cents": 13500,
"original_amount_currency": "EUR",
"route": null
}
],
"vehicle": {
"id": 9,
"name": "Autolla (0.43 EUR/km)",
"country": {
"id": 1,
"name": "Finland",
"currency": "EUR",
"created_at": "2017-09-06T11:51:21.283Z",
"updated_at": "2021-01-15T18:09:35.537Z",
"code": "FI"
},
"years": [
{
"id": 18,
"year": 2019,
"cost_cents": "43.0",
"additional_passenger_cents": "0.0"
},
{
"id": 28,
"year": 2020,
"cost_cents": "43.0",
"additional_passenger_cents": "0.0"
},
{
"id": 30,
"year": 2021,
"cost_cents": "45.0",
"additional_passenger_cents": "1.0"
}
]
},
"documents": []
}
| Param name | Description |
|---|---|
|
draft
optional |
Whether created trip should be in draft state. If the value of this param is 1, trip will be saved as draft and will not be validated; otherwise, it will be either in reviewing or queue state (depending on whether its user has approvers or not). Validations:
|
|
trip
required |
Trip hash Validations:
|
|
trip[description]
required |
Trip description Validations:
|
|
trip[date]
required |
Trip date, e.g. “2021-05-26” Validations:
|
|
trip[mileage_vehicle_id]
required |
Mileage vehicle (from user/company mileage vehicle categories) Validations:
|
|
trip[expense_account_id]
optional , nil allowed |
Mileage account (from user/company settings). Will be set automatically if not passed Validations:
|
|
trip[cost_center_ids]
optional , nil allowed |
Cost center IDs. Should be up to 1 cost center ID per dimension. All optional Validations:
|
|
trip[original_currency]
required |
Mileage vehicle country currency, e.g. “EUR” Validations:
|
|
trip[entries_attributes]
required |
Trip entries. At least one should be present Validations:
|
|
trip[entries_attributes][number_of_people]
required |
Either a number, e.g. “2” or a comma-separated list of passengers, e.g. “Brian Kernigan,Dennis Ritchie,Ken Thompson” Validations:
|
|
trip[entries_attributes][distance]
required |
Trip distance in kilometers Validations:
|
|
trip[entries_attributes][route]
optional , nil allowed |
An optional route description. E.g. “Helsinki-Vantaa-Helsinki” Validations:
|
|
trip[entries_attributes][waypoints_attributes]
optional , nil allowed |
Entry Waypoints. At least 2 are required when present Validations:
|
|
trip[entries_attributes][waypoints_attributes][address]
optional , nil allowed |
Address: short place name, from Google Maps. Internal use only. Validations:
|
|
trip[entries_attributes][waypoints_attributes][latitude]
optional , nil allowed |
Geographic Latitude from Google Maps Validations:
|
|
trip[entries_attributes][waypoints_attributes][longitude]
optional , nil allowed |
Geographic Longitude from Google Maps Validations:
|
|
trip[entries_attributes][waypoints_attributes][position]
optional , nil allowed |
Waypoint position starting from 0. E.g. case with from-to waypoints: 0 for From waypoint, 1 for To waypoint Validations:
|
|
trip[conditional_values_attributes]
optional , nil allowed |
Values for expense account’s conditional fields (optional) Validations:
|
|
trip[conditional_values_attributes][field_id]
optional , nil allowed |
ID of expense account’s conditional field Validations:
|
|
trip[conditional_values_attributes][field_type]
optional , nil allowed |
Field type: Validations:
|
|
trip[conditional_values_attributes][value]
optional , nil allowed |
Conditional field’s value Validations:
|
Get the total cost, mileage cost, and additional passengers cost of the trip in cents, based on vehilcle_id, entries’ distance and number_of_people.
[
{
"vehicle_id": 1,
"date": "2021-05-26",
"entries": [
{
"number_of_people": "Jim, Pam",
"distance": "12.5"
},
{
"number_of_people": "1",
"distance": "12"
}
],
}
]
| Param name | Description |
|---|---|
|
vehicle_id
required |
Mileage vehicle (from user/company mileage vehicle categories) Validations:
|
|
date
required |
Trip date, e.g. “2021-05-26” Validations:
|
|
entries
required |
An array with the specific entry attributes (number_of_people, distance) to pass to calculator. At least one item should be present in array Validations:
|
|
entries[number_of_people]
required |
Either a number, e.g. “2” or a comma-separated list of passengers, e.g. “Brian Kernigan,Dennis Ritchie,Ken Thompson” Validations:
|
|
entries[distance]
required |
Trip distance in kilometers Validations:
|
Trip costs break down in cents
| Param name | Description |
|---|---|
|
mileage
required |
Mileage cost of the trip. Validations:
|
|
additional_passengers
required |
Additional passengers cost of the trip. Validations:
|
|
total_including_tax
required |
Total cost of the trip, including tax. Validations:
|
|
tax
required |
Total tax. Validations:
|
|
total_to_reimburse
required |
Total cost of the trip excluding tax. Validations:
|
|
total
required |
Total cost of the trip. The same value as in Validations:
|
|
emissions
required |
CO₂ emissions estimate (in kg CO₂e). Validations:
|