Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method
POST
Comments
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 Parametersnone 
Query Parameters

 

 

merchantId

Optional in place of cookie
Headers

none

 
Receives JsonChangePasswordRequest String (email)Just a single email address as a string
Returns Jsonnothing (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
themeDJango
languagejavascript
linenumberstrue
  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

Method
GET
Comments
Description

returns customer settings

 

Cookies

UltraCartMerchantID = Merchant ID

UltraCartShoppingCartId - Cart ID

The customer must be logged in.
Path Parametersnone 
Query Parameters

none

 
Headers

none

 
Receives Jsonnone 
Returns JsonMyAccount object

password is not returned. a string of asterisks is returned instead.

Example

 

Code Block
themeDJango
languagejavascript
linenumberstrue
   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

Method
POST
Comments
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 Parametersnone 
Query Parameters

none

 
Headers

none

 
Receives JsonMyAccount object 
Returns JsonMyAccount 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
themeDJango
languagejavascript
linenumberstrue
    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

Method
PUT
Comments
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 Parametersnone 
Query Parameters

none

 
Headers

none

 
Receives JsonMyAccount object 
Returns JsonMyAccount object

password is not returned. a string of asterisks is returned instead.

Example

 

Code Block
themeDJango
languagejavascript
linenumberstrue
  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)

...