{"id":332871,"date":"2022-05-05T09:21:03","date_gmt":"2022-05-05T09:21:03","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=332871"},"modified":"2022-05-16T04:36:19","modified_gmt":"2022-05-16T04:36:19","slug":"how-to-send-put-or-post-request-in-json-using-prestashop-webservices","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/","title":{"rendered":"How to send PUT\/POST request in JSON using PrestaShop webservices"},"content":{"rendered":"\n<p>In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in the PrestaShop webservice.<\/p>\n\n\n\n<p>As we know that in PrestaShop, We can get output data as JSON with <strong>output_format=JSON<\/strong> but can\u2019t post body as JSON. For this, we need to convert our JSON request data into XML.<\/p>\n\n\n\n<p>To achieve this, You have to follow some steps, which we have explained below.<\/p>\n\n\n\n<p>Firstly, We need to make some changes in the PrestaShop WebserviceRequest class. Here is the file path below.<\/p>\n\n\n\n<p><strong>Path:<\/strong> <strong>ROOT_DIR\/classes\/webservice\/WebserviceRequest.php<\/strong><\/p>\n\n\n\n<p>Now we need to modify the existing &#8220;<strong>saveEntityFromXml<\/strong>&#8221; function to convert request data JSON to XML. Find \u201c<strong>saveEntityFromXml<\/strong>\u201d &amp; add this below code at the starting of this function.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/ Code added to convert JSON data into XML\n$requestJson = false;\nif ($_GET&#091;&#039;output_format&#039;] == &#039;JSON&#039;) {\n    $requestJson = true;\n}\nif ($requestJson){\n    $this-&gt;_inputXml = $this-&gt;jsonToXml($this-&gt;_inputXml);\n}\n\/\/ Code end<\/pre>\n\n\n\n<p><strong>Like this:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"1112\" height=\"442\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\" alt=\"Code\" class=\"wp-image-332872\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png 1112w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code-300x119.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code-250x99.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code-768x305.png 768w\" sizes=\"(max-width: 1112px) 100vw, 1112px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><strong>Note: <\/strong>We need to add &#8220;<strong>output_format=JSON<\/strong>&#8221; as a query parameter in API to manage things.<\/p>\n\n\n\n<p>Now there are some functions that you need to put in the same (WebserviceRequest) class. These functions will convert JSON to XML.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/**\n* Function to convert json to XMl\n*\n* @param &#091;type] $json\n* @return void\n*\/\npublic function jsonToXml($json) {\n    $obj = json_decode($json, true);\n    $xml = $this-&gt;arrayToXml($obj);\n\n    return $xml;\n}\n\npublic function arrayToXml($array)\n{\n    $output = &#039;&#039;;\n    header(&#039;Content-type: application\/xml&#039;);\n    $output = &#039;&lt;?xml version=&quot;1.0&quot;?&gt;&#039;.&quot;\\n&quot;;\n    foreach($array as $key =&gt; $value){\n        if (is_array($value)) {\n            $output .= $this-&gt;arrayOfArrayToXml($value, $key);\n        } else {\n            if (!is_array($value)) {\n                $node_content = &#039;&lt;!&#091;CDATA&#091;&#039;.$value.&#039;]]&gt;&#039;;\n                $output .= &#039;&lt;&#039;.$key.&#039;&gt;&#039;.$node_content.&#039;&lt;\/&#039;.$key.&#039;&gt;&#039;.&quot;\\n&quot;;\n            }\n        }\n    }\n\n    return $output;\n}\n\npublic function arrayOfArrayToXml($array, $key, $output = &#039;&#039;)\n{\n    $output .= &#039;&lt;&#039;.$key.&#039;&gt;&#039;.&quot;\\n&quot;;\n    foreach ($array as $name =&gt; $val) {\n        if (is_array($val)) {\n            $output .= $this-&gt;arrayOfArrayToXml($val, $name);\n        } else {\n            $output .= &#039;&lt;&#039;.$name.&#039;&gt;&lt;!&#091;CDATA&#091;&#039;.$val.&#039;]]&gt;&lt;\/&#039;.$name.&#039;&gt;&#039;.&quot;\\n&quot;;\n        }\n    }\n    $output .= &#039;&lt;\/&#039;.$key.&#039;&gt;&#039;.&quot;\\n&quot;;\n\n    return $output;\n}<\/pre>\n\n\n\n<p><strong>PUT\/POST Request:<\/strong><\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">{\n   &quot;customer&quot;: {\n      &quot;lastname&quot;: &quot;Doe&quot;,\n      &quot;firstname&quot;: &quot;John&quot;,\n      &quot;email&quot;: &quot;demo@demo.com&quot;,\n      &quot;associations&quot;: {\n         &quot;groups&quot;: {\n            &quot;group&quot;: {\n               &quot;id&quot;: 2\n            }\n         }\n      }\n   }\n}<\/pre>\n\n\n\n<p>In conclusion, You can see that you have passed the JSON data as request &amp; it&#8217;s changed in XML to manage the further processes. Check the result below.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"683\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1-1200x683.png\" alt=\"Result-1\" class=\"wp-image-332875\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1-1200x683.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1-300x171.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1-250x142.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1-768x437.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Result-1.png 1293w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p>That&#8217;s all about this blog. Hope it will help you.<\/p>\n\n\n\n<p>If you are facing any issues or doubts in the above process, please feel free to contact us through the comment section.<\/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 support@webkul.com  <\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in the PrestaShop webservice. As we know that in PrestaShop, We can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this, we need to convert our JSON request data into XML. To <a href=\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":387,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1173,209,1172],"tags":[5178,2065,4126,3291,3283,2253,3294,294],"class_list":["post-332871","post","type-post","status-publish","format-standard","hentry","category-api-2","category-prestashop","category-web-service","tag-in-prestashop","tag-prestashop","tag-prestashop-1-7","tag-prestashop-webservice","tag-prestashop-webservice-api","tag-rest-api","tag-webservice-api","tag-webservices"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog<\/title>\n<meta name=\"description\" content=\"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.\" \/>\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\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\" \/>\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-05-05T09:21:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-05-16T04:36:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\" \/>\n<meta name=\"author\" content=\"Sunny Kumar\" \/>\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=\"Sunny Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\"},\"author\":{\"name\":\"Sunny Kumar\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/82afaa5265683f080b52d639e7cdaf67\"},\"headline\":\"How to send PUT\/POST request in JSON using PrestaShop webservices\",\"datePublished\":\"2022-05-05T09:21:03+00:00\",\"dateModified\":\"2022-05-16T04:36:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\"},\"wordCount\":266,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\",\"keywords\":[\"in prestashop\",\"prestashop\",\"Prestashop 1.7\",\"Prestashop Webservice\",\"Prestashop WebService API\",\"REST API\",\"Webservice API\",\"webservices\"],\"articleSection\":[\"API\",\"prestashop\",\"web service\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\",\"name\":\"How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\",\"datePublished\":\"2022-05-05T09:21:03+00:00\",\"dateModified\":\"2022-05-16T04:36:19+00:00\",\"description\":\"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png\",\"width\":1112,\"height\":442,\"caption\":\"Code\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to send PUT\/POST request in JSON using PrestaShop webservices\"}]},{\"@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\/82afaa5265683f080b52d639e7cdaf67\",\"name\":\"Sunny Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/71f74f424b1b289dfe7a885325f69bf2ecd11c159d2c3ee19fc5df341650df4c?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\/71f74f424b1b289dfe7a885325f69bf2ecd11c159d2c3ee19fc5df341650df4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Sunny Kumar\"},\"description\":\"Sunny, a Prestashop virtuoso, crafts innovative eCommerce solutions. His expertise in marketplace development is unparalleled, seamlessly integrating modules. With precision coding, Sunny creates robust online stores, ensuring a seamless user experience. His engineering prowess enhances digital retail, leaving a lasting impact on the Prestashop community.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/sunny-kumar912\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog","description":"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.","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\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/","og_locale":"en_US","og_type":"article","og_title":"How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog","og_description":"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.","og_url":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2022-05-05T09:21:03+00:00","article_modified_time":"2022-05-16T04:36:19+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png","type":"","width":"","height":""}],"author":"Sunny Kumar","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Sunny Kumar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/"},"author":{"name":"Sunny Kumar","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/82afaa5265683f080b52d639e7cdaf67"},"headline":"How to send PUT\/POST request in JSON using PrestaShop webservices","datePublished":"2022-05-05T09:21:03+00:00","dateModified":"2022-05-16T04:36:19+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/"},"wordCount":266,"commentCount":2,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png","keywords":["in prestashop","prestashop","Prestashop 1.7","Prestashop Webservice","Prestashop WebService API","REST API","Webservice API","webservices"],"articleSection":["API","prestashop","web service"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/","url":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/","name":"How to send PUT\/POST request in JSON using PrestaShop webservices - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png","datePublished":"2022-05-05T09:21:03+00:00","dateModified":"2022-05-16T04:36:19+00:00","description":"In this blog, We are going to learn how we can send JSON data as PUT\/POST requests in PrestaShop webservices. As we know that in PrestaShop we can get output data as JSON with output_format=JSON but can\u2019t post body as JSON. For this we need to convert our JSON request data in XML.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2022\/05\/Code.png","width":1112,"height":442,"caption":"Code"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-send-put-or-post-request-in-json-using-prestashop-webservices\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to send PUT\/POST request in JSON using PrestaShop webservices"}]},{"@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\/82afaa5265683f080b52d639e7cdaf67","name":"Sunny Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/71f74f424b1b289dfe7a885325f69bf2ecd11c159d2c3ee19fc5df341650df4c?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\/71f74f424b1b289dfe7a885325f69bf2ecd11c159d2c3ee19fc5df341650df4c?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Sunny Kumar"},"description":"Sunny, a Prestashop virtuoso, crafts innovative eCommerce solutions. His expertise in marketplace development is unparalleled, seamlessly integrating modules. With precision coding, Sunny creates robust online stores, ensuring a seamless user experience. His engineering prowess enhances digital retail, leaving a lasting impact on the Prestashop community.","url":"https:\/\/webkul.com\/blog\/author\/sunny-kumar912\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/332871","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\/387"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=332871"}],"version-history":[{"count":8,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/332871\/revisions"}],"predecessor-version":[{"id":335118,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/332871\/revisions\/335118"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=332871"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=332871"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=332871"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}