Manage Transaction Fields - Update
Update fields used when recording customer transactions:
Headers
|
|
Key |
|
Value |
|
Note |
|
|
|
api_access_key |
|
user_api_key |
|
Optional |
|
   
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 if not included in the headers |
|
|
|
type |
|
transaction_fields |
|
Required |
|
|
|
action |
|
update |
|
Required |
|
|
|
account_id |
|
greatwidgets |
|
Required |
|
|
|
custom_field_#_label |
|
Item SKU |
|
optional |
|
|
|
custom_field_#_show |
|
Y |
|
optional |
|
|
|
custom_field_#_type |
|
Text |
|
See Note |
|
|
|
custom_field_#_choices |
|
New|Used|Other |
|
optional |
|
|
|
custom_field_#_activity_type |
|
record, redeem, all |
|
optional |
|
|
|
web_update |
|
Y |
|
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:
- 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:
- $data['API'] = '1.5';
- $data['user_id'] = 'john1970';
- $data['user_api_key'] = '1959caadac9b13dcb3';
- $data['account_id'] = 'greatwidgets';
- $data['type'] = 'transaction_fields';
- $data['action'] = 'update';
- $data['custom_field_1_label'] = 'SKU'
- $data['custom_field_2_show'] = 'N';
- $data['custom_field_6_label'] = 'New Field';
- $data['custom_field_6_show'] = 'Y';
- $data['custom_field_6_type'] = 'Text';
- $data['custom_field_6_activity_type'] = 'redeem';
Success XML Response (lists ONLY the custom fields added):
- <response status="success">
- <account>
- <account_id>test2009050502</account_id>
- <fields>
- <field>
- <name>custom_field_1</name>
- <label>ID</label>
- <show>Y</show>
- <type>Text</type>
- <unique>Yes</unique>
- </field>
- <field>
- <name>custom_field_2</name>
- <label>Tags</label>
- <show>N</show>
- <type>List</type>
- <choices>
- <choice>Tag A</choice>
- <choice>Tag B</choice>
- <choice>Tag C</choice>
- </choice>
- </field>
- <field>
- <name>custom_field_3</name>
- <label>Condition</label>
- <show>Y</show>
- <type>Pick</type>
- <choices>
- <choice>New</choice>
- <choice>Used</choice>
- <choice>Other</choice>
- </choice>
- </field>
- <field>
- <name>custom_field_4</name>
- <label>Expiration Date</label>
- <show>Y</show>
- <type>Date</type>
- </field>
- <field>
- <name>custom_field_5</name>
- <label>Kilograms</label>
- <show>Y</show>
- <type>Number</type>
- </field>
- <field>
- <name>custom_field_6</name>
- <label>New Field</label>
- <show>Y</show>
- <type>Text</type>
- <activity_type>redeem</activity_type>
- </field>
- </fields>
- </account>
- </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:
- <response status="error">
- <error>Error message</error>
- </response>
|