Skip to main content
Aria Knowledge Central

create_discount_rule_m Sample Call and Response

This example shows a call to create_discount_rule_m that defines a discount rule of fifteen percent off eligible plan charges for a set of loyalty plans, based on methods_m_r73.yml, Admin Tools API, release 73.

This example includes every required field for the method, plus a representative set of optional fields describing a duration-based, plan-scoped discount; it does not cover every scope, duration type, or optional field that the method accepts.

Sample call

{
  "rest_call": "create_discount_rule_m",
  "output_format": "json",
  "client_no": 30219,
  "auth_key": "8f3d2c1b9a7e4f6d5c2b1a0f9e8d7c6b",
  "label": "Loyalty Plan Discount",
  "rule_id": "loyalty-plan-disc-2026",
  "description": "Fifteen percent discount on all charges for specified loyalty plans.",
  "ext_description": "Loyalty member discount, fifteen percent off eligible plan charges for six months.",
  "flat_percent_ind": "P",
  "amount": 15,
  "currency": "usd",
  "duration_type_ind": "M",
  "max_applicable_months": 6,
  "inline_offset_ind": "I",
  "discount_behavior_type_ind": "G",
  "service_code_to_use": 0,
  "scope_no": 11,
  "plans": [
    { "plan_no": 40010 },
    { "plan_no": 40011 }
  ],
  "use_all_or_nth_subs_rule": "TRUE"
}

The envelope fields rest_call and output_format sit outside the arguments that methods_m_r73.yml documents for this method; the REST layer adds them to every call, with rest_call naming the method being invoked and output_format requesting a JSON response. The fields client_no and auth_key are not declared under create_discount_rule_m itself; they fall back to the shared param_defaults block, where both are required. The field flat_percent_ind uses value P, which the method defines as a percentage-based discount, as opposed to value F for a flat, fixed-amount discount. The field duration_type_ind uses value M, meaning the discount runs for a fixed number of months, as opposed to alternatives for uses, weeks, days, or a discount that never expires. Because duration_type_ind is M, the optional field max_applicable_months sets that duration to six months. The field scope_no uses value 11, meaning the discount applies to all plan charges on the specified plans, which is why the optional, nested plans field is included; other scope_no values instead require the service or item fields, which this example leaves out. The field service_code_to_use uses value 0, meaning the discount uses the same service as the charge line item it is applied against, so the alternative fields alt_service_no_2_apply and alt_service_id_2_apply, which only matter when service_code_to_use is 1, are not needed here. The field inline_offset_ind uses value I, and discount_behavior_type_ind uses value G; the yml describes both of these only in prose rather than as a formal enumerated values list, so their other documented value (O for inline_offset_ind, and N for discount_behavior_type_ind) applies in scenarios this example does not cover. The nested plans field is a repeatable array, and this example provides two entries, each identified by the Aria-assigned plan_no rather than the client-defined client_plan_id, since plan_no and client_plan_id are alternatives to each other. The optional field use_all_or_nth_subs_rule uses value TRUE, meaning the discount only applies once every listed plan is present on the account, rather than FALSE, which would apply the discount once any one of the listed plans is present.

Sample response

{
  "error_code": 0,
  "error_msg": "OK",
  "rule_no": 88341
}

The error_code value of 0 and the error_msg value of OK indicate that Aria created the discount rule successfully; a nonzero error_code would instead carry a description of what went wrong in error_msg. The response returns the single Aria-assigned rule_no for the newly created rule; this method creates exactly one rule per call, so this field is not an array. This example leaves out max_applicable_weeks, max_applicable_days, remainder_discount_rule_indicator, max_applications_per_acct, alt_service_no_2_apply, alt_service_id_2_apply, applicable_trans_scope, the service field, and the item field, since none of them apply to the months-based, plan-scoped discount this example illustrates.

TOP
  • Was this article helpful?