Skip to main content
Aria Knowledge Central

get_discount_rule_details_m Sample Call and Response

This example shows an administrative client retrieving the full detail of a single discount rule, rule number 900215, a percentage-off rule restricted to specific plan and service charges, based on the get_discount_rule_details_m method defined in methods_m_r73.yml.

This example covers a rule’s pricing, duration, and scope-eligibility fields, along with one locale translation. It does not cover every scope-eligibility variant this method supports (rule_application can instead reference plans only, services only, inventory items, or item SKUs, depending on the rule’s scope_no), since this rule uses the specified plan and service charges variant only.

Sample call

{
  "rest_call": "get_discount_rule_details_m",
  "output_format": "json",
  "client_no": 400218,
  "auth_key": "7f3a9c1d2e4b5f6a8c9d0e1f2a3b4c5d",
  "rule_no": 900215,
  "locale_no": 205,
  "include_translations": "true"
}

Besides client_no and auth_key, rule_no identifies which discount rule to retrieve; rule_no and client_rule_id form an alt_required_field pair, meaning either one alone identifies the rule, and this example uses the Aria-assigned numeric identifier rather than the client-defined one. locale_no and include_translations are optional; locale_no is one side of an alt_required_field pair with locale_name and is passed here to request the Spanish (Latin America) translation of the rule’s text, and include_translations is set to true so that the response includes the discount_rule_translations array.

Sample response

{
  "error_code": 0,
  "error_msg": "OK",
  "discount_rules": [
    {
      "rule_no": 900215,
      "rule_name": "Summer25 Percent Off",
      "rule_id": "SUMMER25-RULE",
      "description": "25 percent discount applied to invoice charges",
      "ext_description": "Summer promotion discount",
      "discount_type": "Percentage",
      "amount": 25,
      "currency": "USD",
      "applicable_trans_scope": "E",
      "duration_type_ind": "M",
      "max_applicable_months": 6,
      "inline_offset_ind": "O",
      "service_code_to_use": 0,
      "scope_no": 13,
      "discount_behavior_type_ind": "N",
      "rule_application": {
        "plan_service": [
          {
            "plan_no": 3050,
            "client_plan_id": "GOLD-MONTHLY",
            "service_no": 8100,
            "client_service_id": "PREMIUM-SUPPORT"
          },
          {
            "plan_no": 3060,
            "client_plan_id": "GOLD-ANNUAL",
            "service_no": 8100,
            "client_service_id": "PREMIUM-SUPPORT"
          }
        ]
      },
      "discount_rule_translations": [
        {
          "locale_name": "es_419",
          "locale_no": 205,
          "rule_name": "Descuento del 25 por ciento en verano",
          "description": "Descuento del 25 por ciento aplicado a los cargos de la factura",
          "ext_description": "Descuento de promocion de verano"
        }
      ]
    }
  ]
}

An error_code of zero with an error_msg of “OK” indicates the request succeeded. The yml wraps this method’s result in the same pluralized discount_rules field used by the list-all method, get_discount_rules_m, and does not mark it struct: single, so this response models it as an array; because a single rule_no was requested, that array always contains exactly one entry. discount_type is a free-text string field with no formal enumerated codes documented in this yml release, so this example spells out Percentage directly; because discount_type is Percentage, the amount of 25 means twenty-five percent rather than a flat currency amount. applicable_trans_scope of E means the discount applies to each transaction on the invoice individually (the alternative, M, applies it across all transactions on the invoice and carries any remaining credit to the next month); this method’s own field definition omits the values list, but the same field is documented with these two codes elsewhere in this yml. duration_type_ind of M means the discount runs for a set duration in months, so max_applicable_months of 6 caps it at six months; the alternative duration types (uses, weeks, days, or never expires) are not shown here. inline_offset_ind of O means the discount is shown as an offsetting line item on the invoice rather than netted directly into the charged line (I would mean inline). service_code_to_use of 0 means the discount is booked under the same service as the charge line item it discounts, so the alternative fields alt_service_no_2_apply and alt_service_id_2_apply, which only apply when service_code_to_use is 1, are left out. scope_no of 13 means the discount is eligible only for specified plan and service charges, so rule_application is populated with a plan_service array pairing the eligible plan and service combinations; this array is shown here with two representative pairs, and it is modeled as an array of objects, not a single object, since a rule can be tied to more than one plan and service combination. rule_application is itself modeled as a single object rather than an array, since a discount rule has exactly one set of eligibility criteria. discount_behavior_type_ind of N means the discount applies to the net amount remaining after any previously applied discounts (the alternative, G, applies it to the gross charge amount before other discounts). discount_rule_translations shows one Spanish-locale entry; if additional locales had translations defined, each would appear as its own entry in this array. Fields left out of this example include max_applicable_weeks, max_applicable_days, max_applications_per_acct, and remainder_discount_rule_indicator (not applicable to this rule’s month-based duration and percentage type), use_all_or_nth_subs_rule (no documented valid values in this yml release), and the plan_no, client_plan_id, service_no, item_no, and client_sku variants of rule_application that apply to other scope_no values instead of 13. client_plan_ids and client_service_ids are left out because the yml marks them nonpublic (placeholders never actually populated), and client_item_ids is left out because it carries a deprecate_version.

TOP
  • Was this article helpful?