create_reason_code_m Sample Call and Response
This example shows a call to create_reason_code_m that creates a new reason code used to explain and account for a service credit, along with the general ledger codes needed to record that credit as a liability at the time it is issued. It is based on methods_m_r73.yml, Admin Tools API.
This example covers a Service Credit type reason code with its liability accounting fields; it does not cover the on_acct_credit_flag path with debit_gl_code and credit_gl_code, which applies when general ledger accounts are meant to be derived from the reason code rather than from the originating transaction, since combining both accounting paths in one example would not reflect a realistic configuration.
Sample call
{
"rest_call": "create_reason_code_m",
"output_format": "json",
"client_no": 10023,
"auth_key": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"type": "Service Credit",
"reason_code": 205,
"reason_code_name": "Service Outage Compensation",
"enable_for_csr": "Y",
"allow_time_restrictions": "Y",
"allow_plan_restrictions": "N",
"record_service_credit_trans": "Y",
"record_liability": 1,
"expense_gl_code": "6100-SVC-CREDIT",
"unapplied_sc_gl_code": "2410-UNAPPLIED-SC",
"canceled_sc_gl_code": "2411-CANCELED-SC",
"expired_sc_gl_code": "2412-EXPIRED-SC"
}
The fields rest_call and output_format are REST-layer additions that sit outside the method’s own documented arguments in the yml; you supply rest_call with the method name and output_format with json to request a JSON response. The required fields are type, reason_code, and reason_code_name, along with the standard client_no and auth_key credentials. Although the yml declares type as a long, its values list actually names each choice by its display label, such as "Service Credit," "Cash Credit," "Credit Memo," "Rebill," "Write Off," and "Refund," with the underlying numeric code shown only in each value’s description; this example passes the label "Service Credit" (numeric code 23) as documented by typeIsName: true. The reason_code value of 205 is a client-chosen number that is unique within the Service Credit type. Setting enable_for_csr to "Y" allows customer service representatives to use this reason code, which in turn allows allow_time_restrictions and allow_plan_restrictions to be meaningfully set to "Y" or "N"; here time-based restrictions are allowed but plan-based restrictions are not. Because record_liability is set to 1, meaning accounting treatment begins at issuance, this example also supplies the four general ledger codes the yml marks as mandatory in that case: expense_gl_code, unapplied_sc_gl_code, canceled_sc_gl_code, and expired_sc_gl_code. The on_acct_credit_flag, debit_gl_code, and credit_gl_code fields are omitted, since they belong to the alternative accounting path described above.
Sample response
{
"error_code": 0,
"error_msg": "OK",
"created_by": "rwest",
"created_date": "2026-07-24 09:15:00"
}
An error_code value of zero, together with an error_msg value of "OK", indicates that Aria created the reason code successfully. Unlike most create methods in this family, create_reason_code_m does not return a new Aria-assigned number for the reason code itself, since reason_code is a client-supplied value; instead it returns created_by, the user who created the record, and created_date, the date and time of creation. This example does not attempt to show a failure response, such as one where reason_code was already in use for the Service Credit type.