SWS UpdateEcommPassword Method
Updates the eStore password/eCommerce code for the specified contact or EcommID. If the customer does not have an password/eCommerce code this would be used to register them for eStore/eCommerce.
Parameters
Name | DataType | Is Required |
---|---|---|
AccountID | Long | Optional* |
Description | The account’s ID number. This is returned when you use the CreateNewAccount method or can be retrieved with the SearchBy method. *Either an EcommID or AccountID is required |
|
EcommID | Long | Optional* |
Description | The account’s eCommerce ID number. *Either an EcommID or AccountID is required |
|
String | Required | |
Description | The email address for the primary contact. This is also used as a username if the site supports eStore or eCommerce. | |
FirstName | String | Optional* |
Description | The given name for a personal account. *This is required if only passing in an AccountID. |
|
LastName | String | Optional* |
Description | The family name for a personal account. *This is required if only passing in an AccountID. |
|
NewPassword | String | Required |
Description | The new password/eCommerce code. For security it’s best to require 1 uppercase letter, 1 lowercase letter, 1 number and have a length of at least 7 characters. Special characters are also suggested. The length of the password/eCommerce code can be customized by the organization, you will need to check with them to confirm the information. | |
OrgID | Long | Required |
Description | The organization’s ID number. |
Returned Parameters
Name | DataType |
---|---|
Successful | Boolean |
Description | Indicates that the password/eCommerce code was updated successfully (“True”) or that the password/eCommerce code failed to update (“False”). |
Example
As with every method we need to pass in credentials. We do this with the LookupUser request object.
We will assume you have a web reference, let us name it SWS, in your Visual Studio project. At this point we need to define our objects. We will need the standard service object, an UpdateEcommPassword request object, and an UpdateEcommPassword response object. We can define and create those like this:
// Create a request and response objects
SWS.WSSoapClient service = new SWS.WSSoapClient();
SWS.UpdateEcommPassword_Request request = new SWS.UpdateEcommPassword_Request();
SWS.UpdateEcommPassword_Response response;
Here is a sample code of the request object (including optional parameters):
// UpdateEcommPassword Request
request.OrgID = 123456;
request.AccountID = 123456;
request.EcommID = 123456; //acccountID and ecommID are now the same ID
request.FirstName = "John";
request.LastName = "Doe";
request.Email = "j.doe@a.c";
request.NewPassword = "TestPass";
Finally we can call the method and pass across the login object and the request object to retrieve our requested information. It’s a good idea to do this in a Try Catch block.
' Call the method that will load the response object
try
{
response = service.UpdateEcommPassword(user_request, request);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
Note that if something goes wrong the service will respond with an exception. You will want to capture the message in the exception so it can be debugged.
For a full list of methods see SWS Methods.