{"id":328944,"date":"2022-04-12T13:08:44","date_gmt":"2022-04-12T13:08:44","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=328944"},"modified":"2022-04-12T13:08:48","modified_gmt":"2022-04-12T13:08:48","slug":"prestashop-webservices-put-method-issue","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/","title":{"rendered":"PrestaShop Webservices : PUT method issue"},"content":{"rendered":"\n<p>PrestaShop webservices use the REST architecture to comply with most of the platforms. It supports most of the popular HTTP methods i.e. GET, POST, PUT, DELETE and HEAD methods, each for a specific purpose. For example, GET request for fetching data, POST for creating data and PUT for updating data in PrestaShop. <\/p>\n\n\n\n<p>Most of the production ready servers block the PUT requests for security purposes. This is because the PUT and DELETE methods originally intend as file management operations so these are considered unsafe to keep open without any prior authentication like a token. However, in case of PrestaShop webservices, this security feature becomes a problem because now the API cannot update data in PrestaShop.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Solution : ps_method parameter<\/h2>\n\n\n\n<p>To solve this, PrestaShop has provided an extra parameter &#8220;ps_method&#8221;. We will discuss how to use this parameter to wrap the HTTP method so that the intended API method is considered at PrestaShop end.<\/p>\n\n\n\n<p>The idea is to keep the request HTTP method as &#8220;POST&#8221;, and add en extra URL parameter &#8220;ps_method&#8221; in the request URL. The value of this parameter is the HTTP method you want to call. In our case, it is &#8220;PUT&#8221;. Let&#8217;s understand with the help of an example:<\/p>\n\n\n\n<p>When you call a request with PUT method and if the server blocks this method, you may get any of these error messages:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>405 Method Not Allowed<\/li><li>403 Forbidden<\/li><\/ul>\n\n\n\n<p>Sometimes it also gives 404 Not found but that is very rare. So it is very easy to identify if the API server is blocking the request. Let&#8217;s say we called the following URL with PUT request:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">http:&#047;&#047;localhost\/PrestaShop\/api\/addresses\/1?ws_key=IHMEWSE7L3GU92JVZ4K7W222TPYP127U<\/pre>\n\n\n\n<p>This request failed with one of the above messages, so we will use the ps_method parameter to convert the request into PUT method while also keeping it POST request for the server:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">http:&#047;&#047;localhost\/PrestaShop\/api\/addresses\/1?ws_key=IHMEWSE7L3GU92JVZ4K7W222TPYP127U&amp;ps_method=PUT<\/pre>\n\n\n\n<p>It solves the problem as the request is actually a POST request, but the PrestaShop identifies the ps_method parameter and considers the request as PUT request. Now the data will be updated successfully with proper 201 response.<\/p>\n\n\n\n<p>That&#8217;s all about the solution to PUT request issue in PrestaShop webservices. If any issue or doubt in the above process, please feel free to let us know in the comment section. <\/p>\n\n\n\n<p>I would be happy to help.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Also, you can explore our <a href=\"https:\/\/webkul.com\/prestashop-development\/\">PrestaShop Development Services<\/a>  and a large range of quality <a href=\"https:\/\/store.webkul.com\/PrestaShop-Extensions.html\">PrestaShop Modules<\/a>.<\/p>\n\n\n\n<p>For any doubt contact us at <a href=\"mailto:support@webkul.com\">support@webkul.com<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>PrestaShop webservices use the REST architecture to comply with most of the platforms. It supports most of the popular HTTP methods i.e. GET, POST, PUT, DELETE and HEAD methods, each for a specific purpose. For example, GET request for fetching data, POST for creating data and PUT for updating data in PrestaShop. Most of the <a href=\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":264,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[12028,12601,12602,2057,2065,12598,12599,4409,294],"class_list":["post-328944","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-403-forbidden","tag-405-not-allowed","tag-http-method","tag-php","tag-prestashop","tag-put","tag-put-blocked-in-server","tag-server","tag-webservices"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>PrestaShop Webservices : PUT method issue - Webkul Blog<\/title>\n<meta name=\"description\" content=\"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PrestaShop Webservices : PUT method issue - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-04-12T13:08:44+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-12T13:08:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Ram Chandra\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Ram Chandra\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\"},\"author\":{\"name\":\"Ram Chandra\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71\"},\"headline\":\"PrestaShop Webservices : PUT method issue\",\"datePublished\":\"2022-04-12T13:08:44+00:00\",\"dateModified\":\"2022-04-12T13:08:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\"},\"wordCount\":406,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"keywords\":[\"403 Forbidden\",\"405 Not Allowed\",\"HTTP Method\",\"PHP\",\"prestashop\",\"PUT\",\"PUT blocked in server\",\"server\",\"webservices\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\",\"url\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\",\"name\":\"PrestaShop Webservices : PUT method issue - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"datePublished\":\"2022-04-12T13:08:44+00:00\",\"dateModified\":\"2022-04-12T13:08:48+00:00\",\"description\":\"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PrestaShop Webservices : PUT method issue\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71\",\"name\":\"Ram Chandra\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Ram Chandra\"},\"url\":\"https:\/\/webkul.com\/blog\/author\/ram-chandra178\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"PrestaShop Webservices : PUT method issue - Webkul Blog","description":"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/","og_locale":"en_US","og_type":"article","og_title":"PrestaShop Webservices : PUT method issue - Webkul Blog","og_description":"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.","og_url":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2022-04-12T13:08:44+00:00","article_modified_time":"2022-04-12T13:08:48+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-og.png","type":"image\/png"}],"author":"Ram Chandra","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ram Chandra","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/"},"author":{"name":"Ram Chandra","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71"},"headline":"PrestaShop Webservices : PUT method issue","datePublished":"2022-04-12T13:08:44+00:00","dateModified":"2022-04-12T13:08:48+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/"},"wordCount":406,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"keywords":["403 Forbidden","405 Not Allowed","HTTP Method","PHP","prestashop","PUT","PUT blocked in server","server","webservices"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/","url":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/","name":"PrestaShop Webservices : PUT method issue - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"datePublished":"2022-04-12T13:08:44+00:00","dateModified":"2022-04-12T13:08:48+00:00","description":"PUT requests are used to update data in PrestaShop webservices. Here is how to manage PUT in such conditions when PUT is blocked on server.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/prestashop-webservices-put-method-issue\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"PrestaShop Webservices : PUT method issue"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/abcd2edf640c51cd905386b99118ad71","name":"Ram Chandra","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a237e2b96f2a8989c930db6c377971a3d52601b0bba3c5e3dc79a88205178d26?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Ram Chandra"},"url":"https:\/\/webkul.com\/blog\/author\/ram-chandra178\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/328944","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/264"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=328944"}],"version-history":[{"count":1,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/328944\/revisions"}],"predecessor-version":[{"id":328991,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/328944\/revisions\/328991"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=328944"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=328944"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=328944"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}