Next revision | Previous revisionNext revisionBoth sides next revision |
v:1.0:api [2012/07/31 20:46] – external edit 127.0.0.1 | v:1.0:api [2013/09/17 12:44] – [Transactions] sami.fiaz |
---|
: **Filter Options:** ''customer_id_filter'', ''customer_email_filter'', ''customer_first_name_filter'', ''customer_last_name_filter'', ''customer_state_filter''. Use an asterisk (''*'') when filtering to do partial matches. | : **Filter Options:** ''customer_id_filter'', ''customer_email_filter'', ''customer_first_name_filter'', ''customer_last_name_filter'', ''customer_state_filter''. Use an asterisk (''*'') when filtering to do partial matches. |
; ''customer_address_get'' | ; ''customer_address_get'' |
: **Required Fields:** ''customer_id'' //or// ''customer_email'' | : **Required Fields:** |
| * ''customer_id'' //or// ''customer_email'' |
| * ''address_id'' //or// ''address_name'' (''address_name'' is the shipto name assigned to each multi-ship address (as specified in the add to cart), a customers default shipping address is recorded as "Me") |
: **Notes:** Only applicable for stores using multi-ship. | : **Notes:** Only applicable for stores using multi-ship. |
; ''customer_address_save'' | ; ''customer_address_save'' |
: **Required Fields:** ''customer_id'' //or// ''customer_email'' | : **Required Fields:** |
| * ''customer_id'' //or// ''customer_email'' |
| * ''address_id'' //or// ''address_name'' (''address_name'' is the shipto name assigned to each multi-ship address (as specified in the add to cart), a customers default shipping address is recorded as "Me") |
: **Notes:** Only applicable for stores using multi-ship. | : **Notes:** Only applicable for stores using multi-ship. |
| : **Record Fields:** ''address_name'', ''shipto_first_name'', ''shipto_last_name'', ''shipto_company'', ''shipto_address1'', ''shipto_address2'', ''shipto_city'', ''shipto_state'', ''shipto_postal_code'', ''shipto_country'' |
; ''attribute_save'' | ; ''attribute_save'' |
: **Notes:** See the ''attribute_save'' documentation under the [[#store|store]] API section. | : **Notes:** See the ''attribute_save'' documentation under the [[#store|store]] API section. |
* The ''customer_password_hash'' value: If you do not have the password in cleartext but would like to update the password, pass in ''customer_password_hash'' //and// the ''customer_password_salt'' (if applicable per your store's [[.:customers#synchronizing_users_and_passwords|password hashing method]]. Whether you pass in a ''customer_password'' or a ''customer_password_hash'', the end result is the same: A hashed password will be returned on ''_get'' requests for the ''customer_password'' field. | * The ''customer_password_hash'' value: If you do not have the password in cleartext but would like to update the password, pass in ''customer_password_hash'' //and// the ''customer_password_salt'' (if applicable per your store's [[.:customers#synchronizing_users_and_passwords|password hashing method]]. Whether you pass in a ''customer_password'' or a ''customer_password_hash'', the end result is the same: A hashed password will be returned on ''_get'' requests for the ''customer_password'' field. |
* The ''cc_number'' field will return a //masked// card number if a payment method is saved. Otherwise it will be empty. | * The ''cc_number'' field will return a //masked// card number if a payment method is saved. Otherwise it will be empty. |
| |
==== Transactions ==== | ==== Transactions ==== |
; ''transaction_get'' | ; ''transaction_get'' |
* ''transaction_date_filter_begin'' (YYYY-MM-DD), ''transaction_date_filter_end'' (YYYY-MM-DD) | * ''transaction_date_filter_begin'' (YYYY-MM-DD), ''transaction_date_filter_end'' (YYYY-MM-DD) |
* ''is_test_filter'', ''hide_transaction_filter'', ''data_is_fed_filter'' (0 or 1), ''id_filter'', ''order_total_filter'', ''coupon_code_filter'' | * ''is_test_filter'', ''hide_transaction_filter'', ''data_is_fed_filter'' (0 or 1), ''id_filter'', ''order_total_filter'', ''coupon_code_filter'' |
* ''customer_id_filter'', ''customer_email_filter'', ''customer_first_name_filter'', ''customer_last_name_filter'', ''customer_state_filter'', ''shipping_state_filter'', ''customer_ip_filter'' | * ''customer_id_filter'', ''customer_email_filter'', ''customer_first_name_filter'', ''customer_last_name_filter'', ''customer_state_filter'', ''customer_country_filter'', ''shipping_state_filter'', ''shipping_country_filter'', ''customer_ip_filter'' |
* ''product_code_filter'', ''product_name_filter'', ''product_option_name_filter'', ''product_option_value_filter'', ''attribute_name_filter'', ''attribute_value_filter'' | * ''product_code_filter'', ''product_name_filter'', ''product_option_name_filter'', ''product_option_value_filter'', ''attribute_name_filter'', ''attribute_value_filter'' |
* ''custom_field_name_filter'', ''custom_field_value_filter'' allow filtering based on //transaction// (not product) custom fields (as entered on the checkout). | * ''custom_field_name_filter'', ''custom_field_value_filter'' allow filtering based on //transaction// (not product) custom fields (as entered on the checkout). |
* ''category'' | * ''category_filter'' |
* ''sub_token'' | * ''sub_token_filter'' |
* Use an asterisk (''*'') when filtering to do partial matches. | * Use an asterisk (''*'') when filtering to do partial matches. |
| |
; ''attribute_delete'' | ; ''attribute_delete'' |
: **Notes:** See the ''attribute_delete'' documentation under the [[#store|store]] API section. | : **Notes:** See the ''attribute_delete'' documentation under the [[#store|store]] API section. |
| |
==== Subscriptions ==== | ==== Subscriptions ==== |
; ''subscription_get'' | ; ''subscription_get'' |
: **Required Fields:** ''sub_token'' (either the token by itself or the complete ''sub_token'' URL) | : **Required Fields:** ''sub_token'' (either the token by itself or the complete ''sub_token'' URL) |
You'd obviously need to insert your own values in that call, but it's provided here for reference. Using CURL can be handy if you just want to get a customer ID quickly, or test to ensure data is being returned as expected. | You'd obviously need to insert your own values in that call, but it's provided here for reference. Using CURL can be handy if you just want to get a customer ID quickly, or test to ensure data is being returned as expected. |
| |
Here's an example to retrieve a transaction: | === Examples === |
| Here's an example **to retrieve a transaction**: |
<code> | <code> |
curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=transaction_get&transaction_id=1234567890" https://example.foxycart.com/api | curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=transaction_get&transaction_id=1234567890" https://example.foxycart.com/api |
</code> | </code> |
And here's how to refeed the [[.:subscription_xml_datafeed|subscription XML datafeed]]: | |
| And here's how **to refeed the [[.:subscription_xml_datafeed|subscription XML datafeed]]**: |
<code> | <code> |
curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=subscription_datafeed" https://example.foxycart.com/api | curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=subscription_datafeed" https://example.foxycart.com/api |
| </code> |
| |
| And how **to change a customer's email address**: |
| <code bash> |
| # First, run this to get the customer ID based on the email: |
| curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=customer_get&customer_email=john.doe@example.com" https://example.foxycart.com/api |
| # Then once you have the ID, enter the ID and the _new_ email address. Below we assume the ID is 193 |
| curl -d "api_token=PUT_YOUR_API_KEY_HERE&api_action=customer_save&customer_id=193&customer_email=john.doh@example.com" https://example.foxycart.com/api |
</code> | </code> |