创建顾客
POST/openapi/2022-01/customers
使用提供的详情创建新顾客。
请求
- application/json
- 请求体
- 示例
请求体
- Array [
- ]
customer object
Should be phone or email. If it's phone, the phone parameter is required, otherwise, the email parameter is required
Email, it's required when contact_type is email, for example: [email protected]
Phone number with area code, it's required when contact_type is phone, for example: +15052814445
First Name, for example: Peter
Last name, for example: Max
Whether to subscribe marketing email campaign
trueWhether to subscribe marketing sms campaign.
truePassword, for example: 123456
Password confirmation, for example: 123456
Tags, for example: New Customer,Repeat Customer
Customer registration time. If this field is empty, you cannot login. The time format is ISO8601, for example: 2024-03-11T03:32:00Z
addresses object[]
First name of consignee.
Last name of consignee.
Street address, for example: 1 Rue des Carrieres
Apartment/floor/room number, for example: Suite 1234
Area, for example: Bay area
City, for example: SAN JOSE
Province, for example: New Mexico
Province Code, for example: NM
Country, for example: United States
Country code, for example: US
Company, for example: ABC Limited
Phone number, for example: 5052814445
Area code, for example: +86
ZIP code, for example: 87036
Gender, for example: male or female
Default address or not
true{
"customer": {
"contact_type": "string",
"email": "string",
"phone": "string",
"first_name": "string",
"last_name": "string",
"accepts_marketing": true,
"accepts_sms_marketing": true,
"password": "string",
"password_confirmation": "string",
"tags": "string",
"registered_at": "string",
"addresses": [
{
"first_name": "string",
"last_name": "string",
"email": "string",
"address1": "string",
"address2": "string",
"area": "string",
"city": "string",
"province": "string",
"province_code": "string",
"country": "string",
"country_code": "string",
"company": "string",
"phone": "string",
"phone_area_code": "string",
"zip": "string",
"gender": "string",
"default": true
}
]
}
}
响应
- 200
- 422
200
- application/json
- 数据结构
- 示例
- Result
数据结构
- Array [
- ]
customer object
2dd957e3-2051-4cdf-8584-9c0046b4d1aeryanzhangryan zhang+8615014471143emailtruetruetruefalsetruefalse000.00New Customer2024-04-17T11:10:33Z2024-04-17T11:10:33Z0505truetruedefault_address object
9ffa8dc0-25b8-4424-832e-bab46fcfeb202dd957e3-2051-4cdf-8584-9c0046b4d1aetesttest深圳Aland lslands515300AX+86 150 1447 1143test test6 三聖街1111Aland lslandstruetrueaddresses object[]
9ffa8dc0-25b8-4424-832e-bab46fcfeb202dd957e3-2051-4cdf-8584-9c0046b4d1aetesttest深圳Aland lslands515300AX+86 150 1447 1143test test6 三聖街1111Aland lslandstruetrue{
"customer": {
"id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "ryan",
"last_name": "zhang",
"name": "ryan zhang",
"phone": "+8615014471143",
"phone_area_code": {},
"contact_type": "email",
"accepts_marketing": true,
"source": {},
"free_tax": false,
"registered": false,
"orders_count": 0,
"last_order_at": {},
"total_spent": "0.00",
"tags": "New Customer",
"created_at": "2024-04-17T11:10:33Z",
"updated_at": "2024-04-17T11:10:33Z",
"subscribed_flag": 5,
"sms_subscribed_flag": 5,
"accepts_sms_marketing": true,
"default_address": {
"id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
"customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "test",
"last_name": "test",
"company": "",
"city": "深圳",
"province": "",
"country": "Aland lslands",
"zip": "515300",
"province_code": "",
"country_code": "AX",
"gender": "",
"phone": "+86 150 1447 1143",
"phone_area_code": {},
"area": "",
"name": "test test",
"address1": "6 三聖街",
"address2": "1111",
"country_name": "Aland lslands",
"default": true
},
"addresses": [
{
"id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
"customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "test",
"last_name": "test",
"company": "",
"city": "深圳",
"province": "",
"country": "Aland lslands",
"zip": "515300",
"province_code": "",
"country_code": "AX",
"gender": "",
"phone": "+86 150 1447 1143",
"phone_area_code": {},
"area": "",
"name": "test test",
"address1": "6 三聖街",
"address2": "1111",
"country_name": "Aland lslands",
"default": true
}
]
}
}
{
"customer": {
"id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "ryan",
"last_name": "zhang",
"name": "ryan zhang",
"phone": "+8615014471143",
"phone_area_code": null,
"contact_type": "email",
"accepts_marketing": true,
"source": null,
"free_tax": false,
"registered": false,
"orders_count": 0,
"last_order_at": null,
"total_spent": "0.00",
"tags": "New Customer",
"created_at": "2024-04-17T11:10:33Z",
"updated_at": "2024-04-17T11:10:33Z",
"subscribed_flag": 5,
"sms_subscribed_flag": 5,
"accepts_sms_marketing": true,
"default_address": {
"id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
"customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "test",
"last_name": "test",
"company": "",
"city": "深圳",
"province": "",
"country": "Aland lslands",
"zip": "515300",
"province_code": "",
"country_code": "AX",
"gender": "",
"phone": "+86 150 1447 1143",
"phone_area_code": null,
"area": "",
"name": "test test",
"address1": "6 三聖街",
"address2": "1111",
"country_name": "Aland lslands",
"default": true
},
"addresses": [
{
"id": "9ffa8dc0-25b8-4424-832e-bab46fcfeb20",
"customer_id": "2dd957e3-2051-4cdf-8584-9c0046b4d1ae",
"first_name": "test",
"last_name": "test",
"company": "",
"city": "深圳",
"province": "",
"country": "Aland lslands",
"zip": "515300",
"province_code": "",
"country_code": "AX",
"gender": "",
"phone": "+86 150 1447 1143",
"phone_area_code": null,
"area": "",
"name": "test test",
"address1": "6 三聖街",
"address2": "1111",
"country_name": "Aland lslands",
"default": true
}
]
}
}
422
- application/json
- 数据结构
- 示例
- Result
数据结构
{
"errors": [
"Email or Phone is already taken"
]
}
{
"errors": [
"Email or Phone is already taken",
"Password is too short (minimum is 6 characters)",
"Contact type is not included in the list",
"Password confirmation must be equal to password",
"Phone is invalid",
"Country can't be blank",
"Country code can't be blank"
]
}