web-services - Creating new customer from API doesn't set the Associations group id
问题描述
I am trying to create a new customer using prestashop webservice on Postman. I already update webservice to accept json format for both input&output. When i try to create a new customer, there is a row added to database but the associations group id is not added.
I get the blank resource by http://mywebsite.com/api/customers?schema=synopsis and here what i get:
{
"customer": {
"id_default_group": "",
"id_lang": "",
"newsletter_date_add": "",
"ip_registration_newsletter": "",
"last_passwd_gen": "",
"secure_key": "",
"deleted": "",
"passwd": "",
"lastname": "",
"firstname": "",
"email": "",
"id_gender": "",
"birthday": "",
"newsletter": "",
"optin": "",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "",
"show_public_prices": "",
"id_risk": "",
"max_payment_days": "",
"active": "",
"note": "",
"is_guest": "",
"id_shop": "",
"id_shop_group": "",
"date_add": "",
"date_upd": "",
"reset_password_token": "",
"reset_password_validity": "",
"associations": {
"groups": [
{
"id": null
}
]
}
}
}
and here is how i fill out the form:
{
"customer": {
"id_default_group": "3",
"id_lang": "1",
"newsletter_date_add": "0000-00-00 00:00:00",
"ip_registration_newsletter": "",
"last_passwd_gen": "",
"secure_key": "",
"deleted": "0",
"passwd": "20101998",
"lastname": "sign up",
"firstname": "test",
"email": "asdfgh@gmail.com",
"id_gender": "2",
"birthday": "0000-00-00",
"newsletter": "0",
"optin": "0",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "0.000000",
"show_public_prices": "0",
"id_risk": "0",
"max_payment_days": "0",
"active": "1",
"note": "",
"is_guest": "0",
"id_shop": "1",
"id_shop_group": "1",
"date_add": "",
"date_upd": "",
"reset_password_token": "",
"reset_password_validity": "0000-00-00 00:00:00",
"associations": {
"groups": [
{
"id": "3"
}
]
}
}
}
and here is the result:
{
"customers": [
{
"id": "41",
"id_default_group": 3,
"id_lang": "1",
"newsletter_date_add": "0000-00-00 00:00:00",
"ip_registration_newsletter": "",
"last_passwd_gen": "2019-11-08 09:24:55",
"secure_key": "c8aa63435abbd3282b22080c903091e4",
"deleted": "0",
"passwd": "$2y$10$mt4u0xuPadIRVsV267Ao8uTGEPU.vixzNMRAfX5P.WY2OJClpBHsW",
"lastname": "sign up",
"firstname": "test",
"email": "asdfgh@gmail.com",
"id_gender": "2",
"birthday": "0000-00-00",
"newsletter": "0",
"optin": "0",
"website": "",
"company": "",
"siret": "",
"ape": "",
"outstanding_allow_amount": "0.000000",
"show_public_prices": "0",
"id_risk": "0",
"max_payment_days": "0",
"active": "1",
"note": "",
"is_guest": "0",
"id_shop": "1",
"id_shop_group": "1",
"date_add": "2019-11-08 15:24:55",
"date_upd": "2019-11-08 15:24:55",
"reset_password_token": "",
"reset_password_validity": "0000-00-00 00:00:00"
}
]
}
You can see that no association return.
Could anyone tell me what I was wrong? I'm quite new to prestashop. Thanks in advance
解决方案
推荐阅读
- javascript - 如何避免发送使用 JQuery remove() 删除的字段的参数
- mysql - mysql:删除行后重置计数器
- javascript - React Redux 组件不会在状态更改时重新渲染
- java - jasypt:加密时强制相同的结果
- javascript - 无法从 API 获取数据
- reactjs - React Native:AsyncStorage 返回值 [object Object] (iOS)
- testng - ExtentReport 记录器 NullPointerException
- c++ - C++ abort() 在函数内调用抽象类对象指针
- django - 如何从自联接表中的数据库中删除朋友?
- python - 使用输入和输出文件加密