---
title: Update Cart
slug: docs/demo/update-cart
description: This document offers a practical code example demonstrating how to make a PATCH request to a hypothetical shopping cart API. The example, written in curl, outlines the essential headers and data required to be included in the request. Explore this insight
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "bK7hawcNUlq7lNmHjcabU",
  "data": {
    "url": "https://api.fictive.com/REST/api/carts/{cartReference}",
    "name": "Update Cart",
    "method": "PATCH",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "cartReference",
          "type": "string",
          "description": "The input cart reference to be patched."
        }
      ],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "patchRequest",
          "type": "array",
          "schema": [
            {
              "kind": "optional",
              "name": "value",
              "type": "object",
              "schema": [],
              "modelRef": "#/definitions/System.Object",
              "customType": "System.Object"
            },
            {
              "kind": "optional",
              "name": "path",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "op",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "from",
              "type": "string",
              "example": ""
            }
          ],
          "modelRef": "#/definitions/Microsoft.AspNet.JsonPatch.JsonPatchDocument[FictiveGlobal.Api.Rest.Dtos.v2.Cart.CartPatch]",
          "customType": "Microsoft.AspNet.JsonPatch.JsonPatchDocument[FictiveGlobal.Api.Rest.Dtos.v2.Cart.CartPatch]",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "204",
        "description": "No Content",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will allow you the ability to link a cart to a specific account and/or contract within the eSuite platform",
    "examples": {
      "languages": [
        {
          "id": "BSxc0UbQO7Z114flvyKfR",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.fictive.com/REST/api/carts/{cartReference} \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-version: string' \\\n     --data '[\n     {}\n     ]'"
        },
        {
          "id": "f8PC20JsIWY9_m9r5_5KE",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar raw = JSON.stringify([\n   {}\n]);\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/carts/{cartReference}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "77EhFtnmlMjGmiQRb-qJg",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/carts/{cartReference}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\nrequest.body = JSON.dump([\n   {}\n])\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "Y9541kDZYaWej3noL7iJr",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/carts/{cartReference}\"\n\npayload = json.dumps([\n   {}\n])\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "BSxc0UbQO7Z114flvyKfR"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-204",
          "language": "204",
          "code": "// No Content\n"
        }
      ],
      "selectedLanguageId": "response-0-204"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}