cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Rest API going to 400 in Magento 2 checkout page for Gift Message

Custom Rest API going to 400 in Magento 2 checkout page for Gift Message

Hello,

I have written custom API for Gift Message that will add $5 on order total based on checkbox check event.

 

If Gift Message checkbox checked then it will add $5 and unchecked and Order total remains same.

 

This API works for the logged in customer fine but not working for the GUEST customer and that gives me 400 Bad Request error while a checking checkbox.

 

Please check below screenshot to get a better idea.

 

https://drive.google.com/file/d/1UQ2Gzlouzzg4JH_4Vml4xZQDq3PO5uf1/view?usp=sharing

 

https://i.imgur.com/awoODUX.png

 

https://i.imgur.com/9ewkKqW.png

 

/public_html/app/code/Mageplaza/Osc/etc/webapi.xml

 

we have declared routes in this file as well.

 

https://drive.google.com/file/d/1TAfyNnN-bUVPhkzbf6vKgTRJhDhm_yKb/view?usp=sharing

 

Where I am doing the mistake I am unable to find this.

 

Anyone can help me to fix these issues much appreciated.

 

Thanks

3 REPLIES 3

Re: Custom Rest API going to 400 in Magento 2 checkout page for Gift Message

Hello @Jignesh Chauhan 

 

400 error,Magento\Framework\Webapi\Exception::HTTP_BAD_REQUEST

Please check your logs once if there any error log related to this.

Manish Mittal
https://www.manishmittal.com/

Re: Custom Rest API going to 400 in Magento 2 checkout page for Gift Message

Hello @Manish Mittal 

 

There is no log generating for this. Even I checked the exception.log file and there is no log found related to this error.

 

Please advice.

 

 

Re: Custom Rest API going to 400 in Magento 2 checkout page for Gift Message

Hello @Jignesh Chauhan 

 

Okay any server or php log?

Manish Mittal
https://www.manishmittal.com/