Missing parameters in ionic 3 while connecting with woocommerce store
Missing parameters in ionic 3 while connecting with woocommerce store
Code is:
signup()
let customerData =
customer :
customerData.customer =
"email": this.newUser.email,
"first_name": this.newUser.first_name,
"last_name": this.newUser.last_name,
"username": this.newUser.username,
"password": this.newUser.password,
"billing_address":
"first_name": this.newUser.first_name,
"last_name": this.newUser.last_name,
"company": "",
"address_1": this.newUser.billing_address.address_1,
"address_2": this.newUser.billing_address.address_2,
"city": this.newUser.billing_address.city,
"state": this.newUser.billing_address.state,
"postcode": this.newUser.billing_address.postcode,
"country": this.newUser.billing_address.country,
"email": this.newUser.email,
"phone": this.newUser.billing_address.phone
,
"shipping_address":
"first_name": this.newUser.first_name,
"last_name": this.newUser.last_name,
"company": "",
"address_1": this.newUser.shipping_address.address_1,
"address_2": this.newUser.shipping_address.address_2,
"city": this.newUser.shipping_address.city,
"state": this.newUser.shipping_address.state,
"postcode": this.newUser.shipping_address.postcode,
"country": this.newUser.shipping_address.country
if(this.billing_shipping_same)
this.newUser.shipping_address = this.newUser.shipping_address;
this.WooCommerce.postAsync('customers',customerData).then( (data) =>
let response = (JSON.parse(data.body));
/ignore the parentheses
Running this code I got this error, which I can't fix:
code: "rest_missing_callback_param", message: "Missing parameter(s): email, password",…
code
:
"rest_missing_callback_param"
data
:
status: 400, params: ["email", "password"]
params
:
["email", "password"]
status
:
400
message
:
"Missing parameter(s): email, password"
3 Answers
3
In data object, send email and password properly:
data: params: email: <email here>, password: <password here>
this.Woocommerce.postAsync('customers',customerData.customer).then((data) =>
console.log (JSON.parse(data.body));
)
The problem is with post function supported by your hosting web site. Typically hosting sites enforce security for post due to which at times body of post is not passed . It is better you create your own hosting server under digital ocean, AWS or GCP and follow the below steps to create a wordpress installation. Once wordpress is installed add the woocommerce plugin and enable CORS using chrome CORS plugin.
https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-16-04
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I use postAsync function
– chiru
Apr 15 at 18:27