API DOCUMENTATION Last Update: Apr 2022

Manage Transaction Fields - Add New Field

Create a new field used when recording customer transactions:

 

The data to be submitted to the API is composed of the following fields:

 

  field   Example   Note
API 1.6 Required
user_id john1970 Required
user_api_key 1959caadac9b13dcb3 Required
type transaction_fields Required
action add Required
account_id greatwidgets Required
custom_field_#_label Item SKU optional
custom_field_#_show Y optional
custom_field_#_type Text Required
custom_field_#_choices New|Used|Other optional
custom_field_#_unique Y optional
custom_field_#_activity_type record, redeem, all optional
Output Format:
output JSON or XML Optional. If not provided, defaults to XML
callback someFunctionName Optional: JSONP format
condensed yes Optional (No white space)
Applies only to JSON(P) output

  

NOTE:

  • Only users with proper permissions can access this call.
  • Multiple fields can be added at the same time.
  • The type is required, and once set, cannot be changed.
  • If a field is received by the API and is missing some of its parameters, it will be created with any such missing values set to their default: Show=No
  • Field types are:
    • Text (up to 255 characters)
    • Number (max precision of 16 digits, with 5 decimal. ie: max value: 99,999,999,999.99999)
    • Monetary (max precision of 14 digits, with 2 decimal. ie: max value: 999,999,999,999.99)
    • Date ("datetime" stamp. Ex: 2012-01-01 14:45:04 )
    • Pick (Requires [field_name]_choices )
    • List (Requires [field_name]_choices )
  • Currently, the only field type that can be set to be "unique" is the Text type. "Unique" fields don't allow a content entry to be a duplicate of an existing one. An example might be an ID code, etc.
  • Additional fields MUST have the following field_name structure:
    • "custom_field_#" where the "#" is any integer above 1
      (one of the default fields is "custom_field_1")
      Example:
      • custom_field_2
      • custom_field_14
      • ...
  • NEW: Field "activity" types
    • record To use the field for accruals (positive transactions)
    • redeem To use the field for redemtions (negative transactions)
    • all To use the field for both, acrruals and redemptions.

Example PHP Request:

If you are using PHP, the $data array would look like this:

  1. $data['API'] = '1.5';
  2. $data['user_id'] = 'john1970';
  3. $data['user_api_key'] = '1959caadac9b13dcb3';
  4. $data['account_id'] = 'greatwidgets';
  5. $data['type'] = 'transaction_fields';
  6. $data['action'] = 'add';
  7. $data['custom_field_1_label'] = 'Item SKU'
  8. $data['custom_field_1_show'] = 'Y';
  9. $data['custom_field_1_type'] = 'Text';
  10. $data['custom_field_2_label'] = 'Tags';
  11. $data['custom_field_2_show'] = 'Y';
  12. $data['custom_field_2_type'] = 'List';
  13. $data['custom_field_2_choices'] = 'Tag A|Tag B|Tag C|Tag D|...';
  14. $data['custom_field_3_label'] = 'Condition';
  15. $data['custom_field_3_show'] = 'Y';
  16. $data['custom_field_3_type'] = 'Pick';
  17. $data['custom_field_3_choices'] = 'New|Used|Other';
  18. $data['custom_field_4_label'] = 'Expiration Date';
  19. $data['custom_field_4_show'] = 'Y';
  20. $data['custom_field_4_type'] = 'Date';
  21. $data['custom_field_5_label'] = 'Kilograms';
  22. $data['custom_field_5_show'] = 'Y';
  23. $data['custom_field_5_type'] = 'Number';
  24. $data['custom_field_5_activity_type'] = 'redeem';

 

Success XML Response (lists ONLY the custom fields added):

  1. <response status="success">
  2. <account>
  3. <account_id>test2009050502</account_id>
  4. <fields>
  5. <field>
  6. <name>custom_field_1</name>
  7. <label>Item SKU</label>
  8. <show>Y</show>
  9. <type>Text</type>
  10. </field>
  11. <field>
  12. <name>custom_field_2</name>
  13. <label>Tags</label>
  14. <show>Y</show>
  15. <type>List</type>
  16. <choices>
  17. <choice>Tag A</choice>
  18. <choice>Tag B</choice>
  19. <choice>Tag C</choice>
  20. </choice>
  21. </field>
  22. <field>
  23. <name>custom_field_3</name>
  24. <label>Condition</label>
  25. <show>Y</show>
  26. <type>Pick</type>
  27. <choices>
  28. <choice>New</choice>
  29. <choice>Used</choice>
  30. <choice>Other</choice>
  31. </choice>
  32. </field>
  33. <field>
  34. <name>custom_field_4</name>
  35. <label>Expiration Date</label>
  36. <show>Y</show>
  37. <type>Date</type>
  38. </field>
  39. <field>
  40. <name>custom_field_5</name>
  41. <label>Kilograms</label>
  42. <show>Y</show>
  43. <type>Number</type>
  44. <activity_type>redeem</activity_type>
  45. </field>
  46. </fields>
  47. </account>
  48. </response>

 

NOTE:

  • The <show> response indicates whether or not this field ought to be shown or not. Usually fields with "N" will have nothing in them. However, it is allowed to add content to any defined field through the API regardless of their <show> status.

 

Error XML Response:

  1. <response status="error">
  2. <error>Error message</error>
  3. </response>