Vehicle - Availability Rules

Vehicle availability rules describe in which timeframe the vehicles belonging to a specified vehicle group can be used

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

/api/vehicle-admin

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

Get vehicle availability rule

Gets details about a specific availability rule:

GET /v1/availability-rules/{id}

Gets details about a specific availability rule

Parameters
  • id (integer) – The id of the rule

Status Codes
DELETE /v1/availability-rules/{id}

Marks a availability rule as deleted

Parameters
  • id (integer) – The id of the rule

Status Codes
id: Rule ID (int)

Returns a Json positive response and the data of the availability rule corresponding to the ID provided in the request:

{
  ID: 11,                                                     // Int
  Group:
  {
    Name: "Vehicle group name",                               // String
    Description: "description",                               // String
    Guid: "9ef25fd1-837d-4dfb-96ba-5e6ee62e1353",             // Guid
    Originator: "32b297a5-8180-420f-9482-84bfc7f55efe"        // Guid
  },
  Type: 2,                                                    // Int
  DayOfWeekStart: 1,                                          // Int (nullable)
  DayOfWeekEnd: 5,                                            // Int (nullable)
  MinuteOfDayStart: 1,                                        // Int (nullable)
  MinuteOfDayEnd: 59,                                         // Int (nullable)
  DayOfMonthStart: 1,                                         // Int (nullable)
  DayOfMonthEnd: 30                                           // Int (nullable)
}

The Type property can only assume the value ‘2’: VehicleAvailability of the RuleType enumeration

The DaysOfWeek and DaysOfMonth fields are mutually exclusive

Get vehicle availability rules list

Gets the list of vehicle availability rules (it’s a Paged List APIs, as explained in the introduction):

GET /v1/availability-rules/list

Gets the list of vehicle availability rules

Status Codes

Returns a list of the vehicle availability rules:

[
  {
    ID: 11,                                                     // Int
    Group:
    {
      Name: "Vehicle group name",                               // String
      Description: "description",                               // String
      Guid: "9ef25fd1-837d-4dfb-96ba-5e6ee62e1353",             // Guid
      Originator: "32b297a5-8180-420f-9482-84bfc7f55efe"        // Guid
    },
    Type: 2,                                                    // Int
    DayOfWeekStart: 1,                                          // Int (nullable)
    DayOfWeekEnd: 5,                                            // Int (nullable)
    MinuteOfDayStart: 1,                                        // Int (nullable)
    MinuteOfDayEnd: 59,                                         // Int (nullable)
    DayOfMonthStart: 1,                                         // Int (nullable)
    DayOfMonthEnd: 30                                           // Int (nullable)
  },
  ...
]

The Type property can only assume the value ‘2’: VehicleAvailability of the RuleType enumeration

The DaysOfWeek and DaysOfMonth fields are mutually exclusive

Add new or edit existing vehicle availability rule

Persists edits about a new or existing availability rule:

POST /v1/availability-rules

Persists edits about a new or existing availability rule

Status Codes

With a request body like this:

{
  ID: 123,                                           // Int
  Type: 2,                                           // Int
  MinuteOfDayStart:1,                                // Int
  MinuteOfDayEnd:59,                                 // Int
  DayOfWeekStart: 1,                                 // Int (nullable)
  DayOfWeekEnd: 5,                                   // Int (nullable)
  DayOfMonthStart: 1,                                // Int (nullable)
  DayOfMonthEnd: 30,                                 // Int (nullable)
  GroupGuid: "53155c4a-b2a0-412f-ab41-552d9ccdf784"  //
}

The only accepted value for the Type property in vehicle availability rule is ‘2’: VehicleAvailability

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

If setting up DaysOfWeek or DaysOfMonth properties, both start and end values must be provided. The start values must not be greater than values of the respective end fields.

Only one between DaysOfWeek or DayOfMonth properties set can be valorized at any time in one vehicle availability rule.

If the record has been successfully added or modified, the request will return a plain Json positive answer. Otherwise a plain Json negative response will be returned.

Possible errors are:

err_MinutesIncorrect

No value provided for either MinuteOfDayStart or MinuteOfDayEnd

err_StartEndOrder

Some of the start values (MinuteOfDayStart, DayOfWeekStart, DayOfMonthStart) are greater than the corrisponding end value (MinuteOfDayEnd, DayOfWeekEnd, DayOfMonthEnd).

err_DaysOfWeekIncorrect

Only one field for DaysOfWeek was provided, both start and end are required when setting DaysOfWeek interval

err_DaysOfMonthIncorrect

Only one field for DaysOfMonth was provided, both start and end are required when setting DaysOfMonth interval

err_MultipleSelectionTypes

Both DaysOfWeek and DaysOfMonth values have been set, only one can be set

err_NoGroup

No group is assigned to the availability rule

err_InvalidElement

The provided type field has a non-accepted value, or no rule to edit has been found for the provided ID

Delete vehicle availability rule

Marks an availability rule as deleted:

GET /v1/availability-rules/{id}

Gets details about a specific availability rule

Parameters
  • id (integer) – The id of the rule

Status Codes
DELETE /v1/availability-rules/{id}

Marks a availability rule as deleted

Parameters
  • id (integer) – The id of the rule

Status Codes
id: Rule ID (int)

Returns a plain Json positive response and marks the corresponding record as deleted if the request is successful.

err_ElementDoesNotExist

No existing record corresponding to the specified ID

err_ElementAlreadyDeleted

The corresponding record has already been marked as deleted