In this blog, We are going to learn how to update specific fields of an object class.
First of all, we want to inform you that in Prestashop 1.7 when you update any resource data you need to send all required fields in the API request using the PUT method because no PATCH method exists in 1.7.
In PrestaShop 8, the PreatShop team introduced a new Request method named PATCH. Using this method you can update some specific fields (which means not need to send all requested fields in the request data).
Let’s understand the process with a live practical.
Before, If we wanted to update any resource then we needed to send all required fields else we would get an error with status code 400 (Bad Request). Check the below image.
In PrestaShop 8, You can make the same request with the PATCH method, You’ll end up with a 200 Ok status & things will be updated in DB as per your request.
That’s all about this blog. Hope it will help you.
If you are facing any issues or have any doubts about the above process, please feel free to contact us through the comment section.
Also, you can explore our PrestaShop Development Services and a large range of quality PrestaShop Modules.
For any doubt contact us at [email protected]
Be the first to comment.