{"id":8508,"date":"2024-06-04T10:32:52","date_gmt":"2024-06-04T10:32:52","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8508"},"modified":"2024-06-04T10:32:53","modified_gmt":"2024-06-04T10:32:53","slug":"updating-users-via-put-method-in-cs-cart-rest-api-using-postman","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/updating-users-via-put-method-in-cs-cart-rest-api-using-postman\/","title":{"rendered":"Updating Users via PUT Method in CS-Cart REST API using Postman"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 2,144<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p class=\"wp-block-paragraph\">To update users using the PUT method in Postman with the CS-Cart REST API, follow these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Authentication<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set the request method to <code>PUT<\/code>.<\/li>\n\n\n\n<li>Set the URL to <code>\/api\/users\/&lt;user_id><\/code>.<\/li>\n\n\n\n<li>Set the <code>Authorization<\/code> header to <code>Basic &lt;base64-encoded email:APIkey pair><\/code>.<\/li>\n\n\n\n<li>Use the email and API key from the CS-Cart admin panel.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">     2. <strong>Request Body<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Set the request body to <code>raw<\/code> and <code>JSON (application\/json)<\/code>.<\/li>\n\n\n\n<li>In the body, provide the updated user data in JSON format. For example:<br><code>json { \"user\": { \"email\": \"new_email@example.com\", \"name\": \"New Name\", \"password\": \"new_password\" } }<\/code><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">     3. <strong>Send the Request<\/strong>:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><\/ol>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Click the <code>Send<\/code> button to send the PUT request to the CS-Cart REST API.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Here is a detailed example:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Example Request<\/h3>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-bb6bffa8944310d1d66e93d616cf1724\"><code><code>PUT \/api\/users\/1\nAuthorization: Basic &lt;base64-encoded email:APIkey pair>\nContent-Type: application\/json\n\n{\n  \"user\": {\n    \"email\": \"new_email@example.com\",\n    \"name\": \"New Name\",\n    \"password\": \"new_password\"\n  }\n}<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Example Response<\/h3>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-50d4ef498b807a894206688e543f4da0\"><code><code>HTTP\/1.1 200 OK\nContent-Type: application\/json\n\n{\n  \"user\": {\n    \"id\": 1,\n    \"email\": \"new_email@example.com\",\n    \"name\": \"New Name\",\n    \"password\": \"new_password\"\n  }\n}<\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Important Notes<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure that the user making the API request has the necessary permissions to update users.<\/li>\n\n\n\n<li>The <code>PUT<\/code> method updates the specified user with the provided data. If you want to create a new user, use the <code>POST<\/code> method.<\/li>\n\n\n\n<li>Always use the correct URL and HTTP method for the specific API endpoint you are interacting with.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>2,144 Views To update users using the PUT method in Postman with the CS-Cart REST API, follow these steps: 2. Request Body: 3. Send the Request: Here is a detailed example: Example Request Example Response Important Notes<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[82],"tags":[],"class_list":["post-8508","post","type-post","status-publish","format-standard","hentry","category-cs-cart"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8508","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8508"}],"version-history":[{"count":1,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8508\/revisions"}],"predecessor-version":[{"id":8509,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8508\/revisions\/8509"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8508"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8508"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8508"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}