...
| | |
---|
Description | Emails customer new password | |
Cookies | UltraCartMerchantID = Merchant ID
| The customer doesn't need to be logged in (obviously), but the Merchant ID is required. |
Path Parameters | none | |
Query Parameters | | merchantId | Optional in place of cookie |
Headers | none | |
Receives Json | ChangePasswordRequest | String (email) | Just a single email address as a string |
Returns Json | nothing (204 on success) | A failed login will result in a 401 Unauthorized http status. Any missing parameers will result in a 400 Bad Request http status. Any parameters too long will result in a 400 Bad Request http statusPlain text | The string "Your password was emailed to " + email is returned on success. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.forgotPassword = function (email, options) {
var msg = null;
options = options || {};
jQuery.ajax({
url: '/rest/myaccount/forgotPassword',
data: JSON.stringify(email),
type: 'post',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
contentType: 'application/json; charset=UTF-8',
dataType: 'text'
}).done(function (result) {
msg = result;
if (options.success) {
options.success(result);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
msg = errorThrown;
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return msg;
}; |
|
/rest/myaccount/settings
| | |
---|
Description | returns customer settings | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| The customer must be logged in. |
Path Parameters | none | |
Query Parameters | none
| |
Headers | none
| |
Receives Json | none | |
Returns Json | MyAccount object | password is not returned. a string of asterisks is returned instead. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.getSettings = function (options) {
options = options || {};
var account = null;
jQuery.ajax({
url: '/rest/myaccount/settings',
type: 'get',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
dataType: 'json'
}).done(function (result) {
account = result;
if (options.success) {
options.success(account);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return account;
}; |
|
/rest/myaccount/settings
| | |
---|
Description | creates a new customer profile | |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| A new account cannot be created if the customer is logged in. They must log out first to create an account. |
Path Parameters | none | |
Query Parameters | none
| |
Headers | none
| |
Receives Json | MyAccount object | |
Returns Json | MyAccount object | the return object will contain the customer profile id (unique identifier) If the merchant account does not allow customer profiles, a 400 Bad Request is returned. If the email is already registered for this merchant, a 400 Bad Request is returned. password is not returned. a string of asterisks is returned instead. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.createAccount = function (customerInformation, options) {
options = options || {};
var account = null;
jQuery.ajax({
url: '/rest/myaccount/settings',
data: JSON.stringify(customerInformation),
type: 'post',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
contentType: 'application/json; charset=UTF-8',
dataType: 'json'
}).done(function (result) {
account = result;
if (options.success) {
options.success(account);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return account;
}; |
|
/rest/myaccount/settings
| | |
---|
Description | updates customer settings | password cannot be updated here. It can only be done through changePassword. |
Cookies | UltraCartMerchantID = Merchant ID
UltraCartShoppingCartId - Cart ID
| A new account cannot be created if the customer is logged in. They must log out first to create an account. |
Path Parameters | none | |
Query Parameters | none
| |
Headers | none
| |
Receives Json | MyAccount object | |
Returns Json | MyAccount object | password is not returned. a string of asterisks is returned instead. |
Example |
Code Block |
---|
theme | DJango |
---|
language | javascript |
---|
linenumbers | true |
---|
| this.changePasswordupdateSettings = function (oldPasswordchanges, newPassword, options) {
options = options || {};
var account = null;
jQuery.ajax({
url: '/rest/myaccount/changePasswordsettings',
data: JSON.stringify({oldPassword: oldPassword, newPassword: newPassword}changes),
type: 'postput',
async: (options.success || options.failure) ? true : false,
headers: { "cache-control": "no-cache" },
cache: false,
contentType: 'application/json; charset=UTF-8',
dataType: 'json'
}).done(function (result) {
account = result;
if (options.success) {
options.success(account);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
if (options.failure) {
options.failure(jqXHR, textStatus, errorThrown);
}
});
return account;
}; |
|
...
TODO:/myaccount/forgotPassword (POST)
/myaccount/settings (GET)
...