get_discount_rules_m Sample Call and Response
This example shows an administrative client retrieving the full list of discount rules defined for client number 400218, including Spanish-locale translations, based on the get_discount_rules_m method defined in methods_m_r73.yml.
This example shows the rule-list view: each rule’s identifying and pricing fields only. It does not show a rule’s duration, scope, or eligibility settings, which is the scope of the related get_discount_rule_details_m method instead.
Sample call
{
"rest_call": "get_discount_rules_m",
"output_format": "json",
"client_no": 400218,
"auth_key": "7f3a9c1d2e4b5f6a8c9d0e1f2a3b4c5d",
"locale_no": 205,
"include_translations": "true"
}
Besides client_no and auth_key, this call passes locale_no, one side of an alt_required_field pair with locale_name (either identifies the locale, so only one is needed), and include_translations, set to true so that the response includes each rule’s translated fields for the requested locale. All three of these arguments are optional; omitting them returns the rule list without locale-specific translations.
Sample response
{
"error_code": 0,
"error_msg": "OK",
"discount_rules": [
{
"rule_no": 900215,
"rule_id": "SUMMER25-RULE",
"description": "25 percent discount applied to invoice charges",
"ext_description": "Summer promotion discount",
"discount_type": "Percentage",
"amount": 25,
"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"
}
]
},
{
"rule_no": 900101,
"rule_id": "WINTER-LOYALTY-RULE",
"description": "Flat ten dollar discount for the winter loyalty campaign",
"ext_description": "Winter loyalty discount",
"discount_type": "Flat",
"amount": 10
},
{
"rule_no": 900330,
"rule_id": "NEWACCT-FLAT5",
"description": "Flat five dollar discount for new accounts",
"ext_description": "New account welcome discount",
"discount_type": "Flat",
"amount": 5
}
],
"currency": "USD"
}
An error_code of zero with an error_msg of “OK” indicates the request succeeded. This response shows three representative discount rules; a real response includes one entry for every discount rule the client has defined, not only these three. discount_type is a free-text string field in this yml release with no formal enumerated codes attached to it, so this example spells out Percentage and Flat directly, consistent with the plain-language description of “flat or percentage based”; when discount_type is Percentage, amount expresses the discount as a percentage rather than a currency amount, so an amount of 25 on the SUMMER25-RULE entry means twenty-five percent. discount_rule_translations is shown only for the SUMMER25-RULE entry to illustrate the shape of the array when include_translations is set to true; in practice every rule in the response would include its own discount_rule_translations array if it has translated values defined for the requested locale. The currency field appears once at the top level of the response, outside the discount_rules array, so it applies to the list as a whole rather than to each rule individually.