Business - Promotions

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 promotion

Gets details about a specific promotion:

GET /v1/promotions/{id}

Gets details about a specific promotion

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

Status Codes
DELETE /v1/promotions/{id}

Marks a specific promotion as deleted

Parameters
  • id (integer) – The promotion to delete

Status Codes
id: Promotion 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: "Test Promotion",                                     // String
  CreatedDate: "2001-01-01T01:01:01Z",                        // DateTime
  LastUpdated: "2001-01-01T01:01:01Z",                        // DateTime
  EffectStart: "2001-01-01T01:01:01Z",                        // DateTime
  EffectEnd: "2001-01-01T01:01:01Z",                          // DateTime
  Amount: 12,                                                 // Int
  MaxDiscount: 12.3,                                          // Decimal (nullable)
  MinDiscount: 12.3,                                          // Decimal (nullable)
  Description: "Description",                                 // String (nullable)
  FilterCommunities: [ Guid Array ],                          // Guid Array (nullable)
  SelectedCommunities: "{\"Community1\",...}",                // String (nullable)
  FilterResourceCategories: [ Guid Array ],                   // Guid Array (nullable)
  SelectedCategories: [ "{\"en\":\"City Car\",...}",... ],    // String Array (nullable)
  FilterResourceGroups: [ Guid Array ],                       // Guid Array (nullable)
  SelectedResourceGroups: "Milan",                            // String (nullable)
  FilterUserGroups: [ Guid Array ],                           // Guid Array (nullable)
  SelectedUserGroups: [ "{\"en\":\"Default Group\"}",... ]    // String Array (nullable)
}

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

Get list of promotions

Gets the list of promotions:

GET /v1/promotions/list

Gets the list of promotions

Status Codes

Returns the list of all promotions:

[
  {
    ID: 3,                                                      // Int
    Name: "Test Promotion",                                     // String
    CreatedDate: "2001-01-01T01:01:01Z",                        // DateTime
    LastUpdated: "2001-01-01T01:01:01Z",                        // DateTime
    EffectStart: "2001-01-01T01:01:01Z",                        // DateTime
    EffectEnd: "2001-01-01T01:01:01Z",                          // DateTime
    Amount: 12,                                                 // Int
    MaxDiscount: 12.3,                                          // Decimal (nullable)
    MinDiscount: 12.3,                                          // Decimal (nullable)
    Description: "Description",                                 // String (nullable)
    FilterCommunities: [ Guid Array ],                          // Guid Array (nullable)
    CommunitiesNames: "{\"Community1\",...}",                   // String (nullable)
    FilterResourceCategories: [ Guid Array ],                   // Guid Array (nullable)
    CategoriesNames: [ "{\"en\":\"City Car\",...}",... ],       // String Array (nullable)
    FilterResourceGroups: [ Guid Array ],                       // Guid Array (nullable)
    ResourceGroupsNames: "Milan",                               // String (nullable)
    FilterUserGroups: [ Guid Array ],                           // Guid Array (nullable)
    UserGroupsNames: [ "{\"en\":\"Default Group\"}",... ]       // String Array (nullable)
  },
  ...
]

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

Add new or edit existing promotion

Persists edits about a new or existing promotion:

POST /v1/promotions

Persists edits about a new or existing promotion

Status Codes

The request body is:

{
  ID: 123,                                     // Int
  Name: "Promotion name",                      // String
  Description: "Description",                  // String (nullable)
  EffectStart: "2001-01-01T01:01:01Z",         // DateTime (nullable)
  EffectEnd: "2001-01-01T01:01:01Z",           // DateTime (nullable)
  Amount: 12,                                  // Int
  MaxDiscount: 12.3,                           // Decimal (nullable)
  MinDiscount: 12.3,                           // Decimal (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 (promotion ID) is not provided or is set to 0, then the request will create a new record. If no value is provided for IsPercent, the default is false. If IsPercent is set to false, MaxDiscount and MinDiscount are set to null.

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

Possible errors are:

err_AmountBadNumberFormat

The value of Amount is not in a valid format.

err_AmountOutOfRange

The value of Amount is less than 1 or greater than 100

err_DiscountBadNumberFormat

The values of MaxDiscount and MinDiscount is not in a valid format (must be a decimal value).

err_InvalidElement

The field Name is empty or null, or if filters for communities or groups are null and the user is not a SuperAdmin

Delete promotion

Marks a specific promotion as deleted:

GET /v1/promotions/{id}

Gets details about a specific promotion

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

Status Codes
DELETE /v1/promotions/{id}

Marks a specific promotion as deleted

Parameters
  • id (integer) – The promotion to delete

Status Codes
id: Promotion ID (int)

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

Possible errors are:

err_ElementDoesNotExist

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

err_ElementAlreadyDeleted

The specified promotion has already been marked as deleted