How to update specific fields in a resource using a webservice in PrestaShop 8

In this blog, we will 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 resource data, you have to send all required fields in the API request using PUT method because no PATCH method exists in the version 1.7.

In PrestaShop 8, the PreatShop team introduced a new request method named PATCH. By using this method you can update some specific fields (meaning you don’t have to send all requested fields in the request data).

Let’s understand the process with a live hands-on exercise.
Before, if we wanted to update a resource, we had to submit all required fields, otherwise we would get an error with status code 400 (bad request). Check the image below.
Prestashop company? Learn more

In PrestaShop 8, You can make the same request with the PATCH method, you will end up with a 200 Ok status and things will be updated in the database as per your request.

That’s all about this blog. I hope this will help you.
If you face any issues or have any doubts about the above process, do not hesitate to contact us through the comments section.
You can also explore our PrestaShop development services and a wide range of quality PrestaShop modules.
For any doubt contact us at (protected email)