Business - Tariffs

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 tariff

Gets details about a specific tariff:

GET /v1/tariffs/{id}

Gets details about a specific tariff

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

Status Codes
DELETE /v1/tariffs/{id}

Marks a specific tariff as deleted

Parameters
  • id (integer) – The tariff to delete

Status Codes
id: Tariff ID (int)

Returns a plain Json negative message if there was a problem retrieving the data or a Json positive response with the requested details:

{
  ID: 3,                                                                      // Int
  Name: "Tariff Name",                                                        // String
  CreatedDate: "2001-01-01T01:01:01Z",                                        // DateTime
  LastUpdated: "2001-01-01T01:01:01Z",                                        // DateTime
  Description: "Description",                                                 // String (nullable)
  BaseAmountPerMinute: 1.23,                                                  // Decimal
  BaseMaxKilometers: 123,                                                     // Int
  BaseAmountPerKilometer: 1.23,                                               // Decimal
  ParkingAmountPerMinute: 1.23,                                               // Decimal
  OverbaseAmountPerMinute: 1.23,                                              // Decimal
  OverbaseAmountPerKilometer: 1.23,                                           // Decimal
  BaseToleranceKilometers: 123,                                               // Int
  BaseToleranceMinutes: 123,                                                  // Int
  FixedBaseFee: 1.23,                                                         // Decimal
  BillingMinutes: 15,                                                         // Int (nullable)
  IsFixedFeeDiscountable: true,                                               // Boolean
  FilterCommunities: [ Guid Array ],                                          // Guid Array  (nullable)
  SelectedCommunities: "Community1,...",                                      // String (nullable)
  FilterResourceCategories: [ Guid Array ],                                   // Guid Array (nullable)
  SelectedCategories: [ "{\"en\":\"a001CatE\",\"it\":\"a001CatI\"}",... ],    // String Array (nullable)
  FilterResourceGroups: [ Guid Array ],                                       // Guid Array (nullable)
  SelectedResourceGroups: "Group1,...",                                       // String (nullable)
  FilterUserGroups: [ Guid Array ],                                           // Guid Array (nullable)
  SelectedUserGroups: [ "{\"en\":\"a0001E\",\"it\":\"a0001I2\"}",... ],       // String Array (nullable)
  DayOfWeekStart: 123,                                                        // Int (nullable)
  DayOfWeekEnd: 123,                                                          // Int (nullable)
  MinuteOfDayStart: 123,                                                      // Int (nullable)
  MinuteOfDayEnd: 123,                                                        // Int (nullable)
  DayOfMonthStart: 123,                                                       // Int (nullable)
  DayOfMonthEnd: 123,                                                         // Int (nullable)
  DayStart: "2001-01-01T01:01:01Z",                                           // DateTime (nullable)
  DayEnd: "2001-01-01T01:01:01Z",                                             // DateTime (nullable)
  DeletionDate: "2001-01-01T01:01:01Z"                                        // DateTime (nullable)
}

The fields SelectedCategories and SelectedUserGroups contain a stringified Json array containing pairs “language code”:”localized value”

Get list of tariffs

Gets the list of tariffs:

GET /v1/tariffs/list

Gets the list of tariffs asynchronously

Status Codes

Returns a list of all tariffs:

[
  {
    ID: 3,                                                                      // Int
    Name: "Tariff Name",                                                        // String
    CreatedDate: "2001-01-01T01:01:01Z",                                        // DateTime
    LastUpdated: "2001-01-01T01:01:01Z",                                        // DateTime
    Description: "Description",                                                 // String (nullable)
    FilterCommunities: [ Guid Array ],                                          // Guid Array (nullable)
    CommunitiesNames: "Community1,...",                                         // String (nullable)
    FilterResourceCategories: [ Guid Array ],                                   // Guid Array (nullable)
    CategoriesNames: [ "{\"en\":\"a001CatE\",\"it\":\"a001CatI\"}",... ],       // String Array (nullable)
    FilterResourceGroups: [ Guid Array ],                                       // Guid Array (nullable)
    ResourceGroupsNames: "Group1,...",                                          // String (nullable)
    FilterUserGroups: [ Guid Array ],                                           // Guid Array (nullable)
    UserGroupsNames: [ "{\"en\":\"a0001E\",\"it\":\"a0001I2\"}",... ],          // String Array (nullable)
    DayOfWeekStart: 123,                                                        // Int (nullable)
    DayOfWeekEnd: 123,                                                          // Int (nullable)
    MinuteOfDayStart: 123,                                                      // Int (nullable)
    MinuteOfDayEnd: 123,                                                        // Int (nullable)
    DayOfMonthStart: 123,                                                       // Int (nullable)
    DayOfMonthEnd: 123,                                                         // Int (nullable)
    DayStart: "2001-01-01T01:01:01Z",                                           // DateTime (nullable)
    DayEnd: "2001-01-01T01:01:01Z",                                             // DateTime (nullable)
    DeletionDate: "2001-01-01T01:01:01Z"                                        // DateTime (nullable)
  },
  ...
]

The fields CategoriesNames and UserGroupsNAmes contain a stringified Json array containing pairs “language code”:”localized value”

Add new or edit existing tariff

Persists edits about a new or existing tariff:

POST /v1/tariffs

Persists edits about a new or existing tariff

Status Codes

The request body is:

{
  ID: 123,                                   // Int
  Name: "Tariff Name",                       // String
  Description: "",                           // String (nullable)
  BaseToleranceMinutes: 123,                 // Int (nullable)
  BaseAmountPerMinute: 1.23,                 // Decimal (nullable)
  OverbaseAmountPerMinute: 1.23,             // Decimal (nullable)
  BaseMaxKilometers: 123,                    // Int (nullable)
  BaseToleranceKilometers: 123,              // Int (nullable)
  BaseAmountPerKilometer: 1.23,              // Decimal (nullable)
  OverbaseAmountPerKilometer: 1.23,          // Decimal (nullable)
  ParkingAmountPerMinute: 1.23,              // Decimal (nullable)
  FixedBaseFee: 1.23,                        // Decimal
  BillingMinutes: 15,                        // Int (nullable)
  IsFixedFeeDiscountable: true,              // Boolean
  MinuteOfDayStart: 123,                     // Int (nullable)
  MinuteOfDayEnd: 123,                       // Int (nullable)
  DayOfWeekStart: 123,                       // Int (nullable)
  DayOfWeekEnd: 123,                         // Int (nullable)
  DayOfMonthStart: 123,                      // Int (nullable)
  DayOfMonthEnd: 123,                        // Int (nullable)
  DayStart: "2020/01/01 00:00:00",           // DateTime (nullable)
  DayEnd: "2020/01/01 00:00:00",             // DateTime (nullable)
  FilterCommunities: [ Guid Array ],         // Guid Array (nullable)
  FilterResourceCategories: [ Guid Array ],  // Guid Array (nullable)
  FilterResourceGroups: [ Guid Array ],      // Guid Array (nullable)
  FilterUserGroups: [ Guid Array ]           // Guid Array (nullable)
}

If ID (tariff ID) is not provided or set to 0, then the request will create a new record.

If setting up Day, DaysOfWeek or DaysOfMonth rules, both start and end values must be provided.

Only one between Day, DaysOfWeek or DayOfMonth can be active at any time in one tariff.

All the kilometers and minuts fees data can be passed as null, and in that case they will be set at the default value of 0.

A plain Json positive response will be returned if the record was sucessfully added or updated.

Possible errors are:

err_BadNumberFormat

Some numeric field is not a valid format (integer o decimal, as in example)

err_MinutesIncorrect

Value provided for only one of either MinuteOfDayStart or MinuteOfDayEnd

err_DaysOfWeekIncorrect

Value provided for only one of either DayOfWeekStart or DayOfWeekEnd

err_DaysOfMonthIncorrect

Value provided for only one of either DaysOfMonthStart or DaysOfMonthEnd

err_MultipleSelectionTypes

Two or more of DaysOfWeek, DaysOfMonth or Day values have been set. Only one type can be set

err_InvalidElement

The field Name is empty or null, no filter community or groups is set and the user is not a SuperAdmin, or no tariff to edit has been found for the provided IS

Delete tariff

Marks a specific tariff as deleted:

GET /v1/tariffs/{id}

Gets details about a specific tariff

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

Status Codes
DELETE /v1/tariffs/{id}

Marks a specific tariff as deleted

Parameters
  • id (integer) – The tariff to delete

Status Codes
id: Tariff ID (int)

Returns a plain Json positive response if the tariff was successfully marked as deleted.

Possible errors are:

err_ElementDoesNotExist

There is no tariff corresponding to the ID specified in the requested

err_ElementAlreadyDeleted

The specified tariff has already been marked as deleted