Business - Additional Amounts

The Admin interface handles web service calls from the Admin web gui. The base url for this is at:

/api/business-admin

A JSON file with OpenAPI data about all business-related admin APIs can be downloaded here.

Get additional cost types

Gets the paged list (see Paged List APIs) of existing additional cost types.

GET /v1/additional-costs/types/list

Gets a list of additional amount types

Query Parameters
  • types (string) – A string representing the macro-type to be translated

Status Codes

The API accepts the following filters in the query params: * types (comma separated list of macro-types, as int value, to be extracted)

Returns a positive response with the list of the extracted additional cost types:

[
  {
    ID: 1,                                 // Int
    LastUpdated: "2021-01-01 06:00:00",    // DateTime
    LastUpdatedBy: "Administrator",        // String (nullable)
    CostType: 0,                           // Int
    Labels: "{"en":"Speed Fine", ... }     // String
  },
  { ... }
]

where the value of CostType represent the cost macro-type, and is among the ones described in the AdditionalCostTypes enumeration.

Get macro-cost additional cost types

Gets the full list of additional cost types belonging to a specified macro-type.

GET /v1/additional-costs/types/{type}/list

Gets a list of additional amount types by macro-type

Parameters
  • type (integer) –

Status Codes

Returns a positive response with the list of the extracted additional cost types:

[
  {
    ID: 1,                                 // Int
    LastUpdated: "2021-01-01 06:00:00",    // DateTime
    LastUpdatedBy: "Administrator",        // String (nullable)
    CostType: 0,                           // Int
    Labels: "{"en":"Speed Fine", ... }     // String
  },
  { ... }
]

where the value of CostType represent the cost macro-type, and is among the ones described in the AdditionalCostTypes enumeration.

Add new or edit existing additional cost type

Persists informations about a new or existing additional cost type:

POST /v1/additional-costs/types

Persists edits about a new or existing amount type

Status Codes

The API accepts a request body in the following format:

{
  "ID": 1,                                // Int (nullable)
  "CostType": 0,                          // Int
  "Labels": "{"en":"Speed Fine", ... }    // String
}

where the value of CostType represent the cost macro-type, and is among the ones described in the AdditionalCostTypes enumeration.

Possible errors are:

err_InvalidElement

No label has been provided, no cost type has been provided or the provided cost type does not map to the accepted values

Delete additional cost type

Deletes an existing additional cost:

DELETE /v1/additional-costs/types/{id}

Marks an amount type as deleted

Parameters
  • id (integer) – The type to delete

Status Codes

Possible errors are:

err_TypeNotFound

The specified additiona cost type does not exists

err_AdditionalAmountPresent

There already exists some additional amounts relatedo to the specified cost type

Get additional cost

Gets data about a specified additional cost

GET /v1/additional-costs/{id}

Gets details about a specific additional costo

Parameters
  • id (integer) – The cost to retrieve data for

Status Codes

The API responds with the data of the specified additional cost:

{
  ID: 1,                                                  // Int
  CreatedDate: "2021-01-01T06:00:00Z",                    // Date
  LastUpdated: "2021-01-01T06:00:00Z",                    // Date
  Amount: 10.30,                                          // Decimal
  Notes: "...",                                           // String (nullable)
  TripGuid: "b5849483-ee93-4ca5-961a-6e21dc8c56dd",       // Guid
  StartLocationName: "Milan",                             // String
  StartTimestamp: "2021-01-01 06:00:00",                  // Date
  EndLocationName: "Milan",                               // String
  EndTimestamp: "2021-01-01 06:00:00",                    // Date
  TypeID: 1,                                              // Int
  CostType: 0,                                            // Int
  Labels: "{"en":"Speed Fine", ... },                     // String
  ExtUserGuid: "8a3f4177-da9f-485f-b1c3-c7c1f3085ce6",    // Guid
  PaymentID: 1,                                           // Int (nullable)
  PaymentStatus: 0,                                       // Int (nullable)
  PaymentExecutionAttemt: "2021-01-01T06:30:00Z",         // Date (nullable)
  PaymentExecutionUser: "administrator",                  // String (nullable)
  PaymentNotes: "some notes"                              // String (nullable)
}

where the value of CostType represent the cost macro-type, and is among the ones described in the AdditionalCostTypes enumeration, the value of PaymentStatus can is among the ones descirbed in the PaymentStatuses enumeration, and TripGuid, TypeID, ExtUserGuid and PaymentID are reference respectively to the trip the cost is related to, the cost additional cost type, the executing user of the trip and the specific payment.

Add new or edit existing additional cost

Persists informations about a new or existing additional cost:

POST /v1/additional-costs

Persists edits about a new or existing additional cost

Status Codes

The API accepts a request body in the following format:

{
  "ID": 1,                                               // Int (nullable)
  "TripGuid": "b5849483-ee93-4ca5-961a-6e21dc8c56dd",    // Guid
  "TypeID": 1,                                           // Int
  "Amount": 12.3                                         // Decimal
  "Notes": "..."                                         // String (nullable)
}

Possible errors are:

err_NoTrip

The provided trip guid does not map to an existing trip

err_NoAmountType

The provided type id does not map to an existing additional amount type

err_InvalidElement

No type id was provided when creating a new additional amount or either a negative, zero or not existing amount were been provided