Customer Login
The POST endpoint allows a customer to log in and submit their cart details.
Endpoint
- URL:
/customer/login - Method:
POST
Authentication
- Header:
accessToken - Type: Bearer Token
- Value:
<ACCESS-TOKEN>
Request Headers
| Header | Type | Description |
|---|---|---|
Content-Type | string | Must be application/json. |
accessToken | string | Access token for authentication. (required) |
Request Body
The request body should include the customer's email and optionally the cart items they wish to submit. The structure is as follows:
| Field | Type | Description |
|---|---|---|
email | string | The customer's email address. |
cart | object | The customer's cart, containing items. |
Cart Object:
| Field | Type | Description |
|---|---|---|
items | array | A list of items in the cart. |
Items Array:
Each item in the items array can include:
| Field | Type | Description |
|---|---|---|
sku | string | Stock Keeping Unit identifier for the product. |
uom | string | Unit of Measure for the product, e.g., "CS". |
quantity | number | Quantity of the item being purchased. |
Sample Request Body
{
"email": "jrandazzo@anadigics.com",
"cart": {
"items": [
{
"sku": "MAR 2930",
"uom": "CS",
"quantity": 3
}
]
}
}
Response
- Status Code: 200 OK
Sample Response Body
{
"success": true,
"code": "<one_time_login_code>"
}
Success Response Fields
| Field | Type | Description |
|---|---|---|
success | boolean | Indicates the success status of the login attempt, typically true for successful login. |
code | string | A one-time login code provided to the customer upon successful login. |
Error Responses
| Status Code | Description |
|---|---|
| 400 | Bad Request: Invalid input data. |
| 401 | Unauthorized: Access token is invalid or missing. |
| 403 | Forbidden: Invalid email or other login credentials. |
| 500 | Internal Server Error: An error occurred on the server. |
Notes
- Ensure the email and cart details are correctly entered in the body of the request.
- Provide a valid and active access token in the request header to authenticate your request.
- The one-time login code can be used for subsequent authentication or operations.