...
Method | GET | Comments | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Description | returns MyAccount object if logged in, else empty object | Useful for determining if the customer is logged in without triggering a 401 Unauthorized response from the server. In the demo, this call is only used on the main page to determine whether to show the login screen or not. Most of the MyAccount pages will use security like this:
| |||||||||||
Cookies |
| ||||||||||||
Path Parameters | none | ||||||||||||
Query Parameters | none | ||||||||||||
Headers | none | ||||||||||||
Receives Json | none | ||||||||||||
Returns Json | MyAccount object if logged in, else empty object | Note: To avoid json parser errors from the likes of FireFox, if the customer is not logged in, the method does NOT return null. It returns an empty object. So your check for logged in status should be something like this: .done(function (result) { settings = result; } else { By checking both 'result' and 'result.email' Notice the example below checks for both result and result.email, so it's checking for a valid object that has some properties as well. By checking both 'result' and 'result.email' for values, you'll get correct results as to whether the customer is logged in or not. | |||||||||||
Example |
|
/rest/myaccount/login
Method | GET or POST | Comments | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Description | logs in a customer and returns their base information (MyAccount object) | There are two ways to login: GET or POST. For the GET, the three parameters are submitted. For POST, a CustomerCredentials object is submitted (it's a simple object with three fields). | |||||||||
Cookies |
| not required, but if passed along and valid, the same shopping cart will continue to be used. Otherwise, a new cart is created and Set-Cookie headers will accompany a successful login. | |||||||||
Path Parameters | none | ||||||||||
Query Parameters | For GET:
password For POST: none | ||||||||||
Headers | none | ||||||||||
Receives Json | CustomerCredentials | ||||||||||
Returns Json | MyAccount object if successful | A failed login will result in a 401 Unauthorized http status. Any missing parameers will result in a 400 Bad Request http status. | |||||||||
Example |
|
...