{
    "content": "<h1>Understanding <a href=\"..\/PUT-Requests\/\">PUT-Requests<\/a><\/h1><p>The <a href=\"..\/PUT\/\">PUT<\/a> method is a core component of the <a href=\"..\/HTTP\/\">HTTP<\/a> protocol, specifically designed for <a href=\"..\/CRUD\/\">CRUD<\/a> operations within a <a href=\"..\/REST-API\/\">REST-API<\/a>. Its primary purpose is to update an existing resource or create a resource at a known <a href=\"..\/URI\/\">URI<\/a>. When a client sends a <a href=\"..\/PUT\/\">PUT<\/a> request, it typically includes a complete <a href=\"..\/JSON\/\">JSON<\/a> or <a href=\"..\/XML\/\">XML<\/a> representation of the resource in the request body.<\/p><p>One of the most important concepts regarding this method is <a href=\"..\/Idempotency\/\">Idempotency<\/a>. As defined by <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTTP\/Methods\/PUT\">MDN Web Docs<\/a>, an idempotent operation is one where multiple identical requests have the same effect as a single request. This contrasts with the <a href=\"..\/POST\/\">POST<\/a> method, where repeated requests might result in the creation of duplicate records. If the server successfully updates a resource, it usually returns a 200 (OK) or 204 (No Content) status code. If the <a href=\"..\/Server\/\">Server<\/a> successfully creates a new resource at the specified <a href=\"..\/Endpoint\/\">Endpoint<\/a>, a 201 (Created) response is expected, as detailed in the <a href=\"https:\/\/datatracker.ietf.org\/doc\/html\/rfc7231#section-4.3.4\">RFC 7231<\/a> standard.<\/p><p>Developers must distinguish <a href=\"..\/PUT\/\">PUT<\/a> from the <a href=\"..\/PATCH\/\">PATCH<\/a> method. While <a href=\"..\/PUT\/\">PUT<\/a> replaces the entire resource state, <a href=\"..\/PATCH\/\">PATCH<\/a> is used for partial updates. For example, if a client only needs to change a user's email address without sending the full profile data, <a href=\"..\/PATCH\/\">PATCH<\/a> is more efficient, whereas <a href=\"..\/PUT\/\">PUT<\/a> would require the entire user object to be sent to avoid accidental data loss or resetting fields to default values.<\/p><ul><li><a href=\"..\/HTTP-Methods\/\">HTTP-Methods<\/a><\/li><li><a href=\"..\/API-Design\/\">API-Design<\/a><\/li><li><a href=\"..\/Idempotency\/\">Idempotency<\/a><\/li><li><a href=\"..\/RESTful-Services\/\">RESTful-Services<\/a><\/li><\/ul>",
    "tags": [
        "api",
        "put",
        "http",
        "rest",
        "web-development",
        "idempotency",
        "backend",
        "crud",
        "request-methods",
        "json"
    ]
}