php - 使用 WooCommerce API 创建新客户需要密码确认
问题描述
发送此 POST 数据时
{
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"username": "john.doe",
"password": "Hashem123123@@@",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
}
}
使用基本身份验证到https://example.com/wp-json/wc/v3/customers 。我有以下回应
{
"code": "error_confirm_password_empty",
"message": "Invalid confirmation password",
"data": {
"status": 400
}
}
注意: 此注册应该提交给管理员进行批准。也许这个终点是直接注册,还有另一个终点是提交注册以供批准(?)我检查了 WooCommerce文档,似乎没有任何类似的东西。
解决方案
您可以将以下项目与现有数组一起添加。
{
"email": "john.doe@example.com",
"first_name": "John",
"last_name": "Doe",
"username": "john.doe",
"password": "Hashem123123@@@",
"confirm_password": "Hashem123123@@@",
"billing": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US",
"email": "john.doe@example.com",
"phone": "(555) 555-5555"
},
"shipping": {
"first_name": "John",
"last_name": "Doe",
"company": "",
"address_1": "969 Market",
"address_2": "",
"city": "San Francisco",
"state": "CA",
"postcode": "94103",
"country": "US"
}
}
推荐阅读
- font-awesome - 如何在 Vuetify 和 Nuxt.js 中使用 Font-Awesome SVG
- python - 如何使用多行和多列作为输入在 DataFrame Column 上应用函数?
- alexa - 如何询问 Alexa 技能的语音评级?
- c# - 在 DataTable Delete 操作中多次发送 Ajax 请求 - ASP.NET、JQuery、Ajax
- powershell - 将查询对象格式化为数组
- javascript - 为什么严格模式不会在重复的属性名称上引发语法错误?
- python - 如果在“-”和“-”之间,则打印字符串
- android - 如何在android模拟器上以编程方式设置虚拟场景图像
- javascript - 如何在具有“contenteditable”属性的元素上触发功能?
- c - 如何指示 MSVC 编译器使用 64 位/32 位除法而不是较慢的 128 位/64 位除法?