---
title: Allows adding products to a pre defined bundle
slug: docs/demo/allows-adding-products-to-a-pre-defined-bundle
description: Learn how to use cURL, the powerful command-line tool for making HTTP requests, with this code example. Discover how to easily make a POST request to any endpoint, complete with essential headers and request data. Master the art of efficient and effective
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "uzKsIFYlM_BS90Ys59ssO",
  "data": {
    "url": "https://api.fictive.com/REST/api/bundles/{bundleReference}/products",
    "name": "Allows adding products to a pre defined bundle",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "bundleReference",
          "type": "string",
          "description": "Reference of the bundle 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": "productInfo",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "products",
              "type": "array",
              "schema": [
                {
                  "kind": "optional",
                  "name": "productReference",
                  "type": "string",
                  "example": "",
                  "description": "Product Reference"
                },
                {
                  "kind": "optional",
                  "name": "quantity",
                  "type": "integer<int32>",
                  "example": 0,
                  "description": "Quantity"
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleProduct",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleProduct[]",
              "description": "List of bundle product objects that are being added to a bundle"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleProductInfo",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleProductInfo",
          "isExpanded": true,
          "description": "DTO for products to be added to a bundle"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "name",
                "type": "string",
                "example": "",
                "description": "The bundle name"
              },
              {
                "kind": "optional",
                "name": "description",
                "type": "string",
                "example": "",
                "description": "The bundle description"
              },
              {
                "kind": "optional",
                "name": "tag",
                "type": "string",
                "example": "",
                "description": "The optional bundle tag"
              },
              {
                "kind": "optional",
                "name": "status",
                "type": "string<Active | Inactive | Archived>",
                "example": "",
                "description": "The bundle's status"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Bundle.Bundle",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Bundle.Bundle",
            "isExpanded": true,
            "description": "The Dto of a bundle"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "Ok",
        "jsonExample": "{\n  \"bundleReference\": \"001PB4PI6KTXCYR8R4\",\n  \"carts\": [\n    {\n      \"cartReference\": \"0010K4PI6KTXCYFT82\",\n      \"active\": true,\n      \"contractReference\": \"0010C4PI6KTXCYB8R9\",\n      \"lineItems\": [\n        {\n          \"lineItemReference\": \"0010I4PI6KTEVRY8R2\",\n          \"description\": \"The first line item in the cart\",\n          \"pricing\": {\n            \"grossAmount\": 2.5,\n            \"netAmount\": 2.08,\n            \"taxAmount\": 0.42,\n            \"currency\": \"GBP\"\n          },\n          \"quantity\": 1,\n          \"productInfo\": {\n            \"title\": \"Example Product\",\n            \"productReference\": \"0010BMGYFRT04\"\n          },\n          \"customLineItemParameters\": {}\n        }\n      ]\n    }\n  ],\n  \"name\": \"Bundle #1\",\n  \"description\": \"The first bundle\",\n  \"tag\": \"A002\",\n  \"status\": \"Active\"\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Bad Request\r\n            <br />• Invalid currency provided",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found\r\n            <br /> • Bundle not found\r\n            <br /> • Product reference cannot be found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "409",
        "description": "Conflict\r\n            <br />• Duplicate product reference\r\n            <br />• Bundle tag already exists\r\n            <br />• Product(s) currency does not match bundle currency\r\n            <br />• No common product currencies found\r\n            <br />• A product cannot be assigned to a bundle more than once.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will allow you the ability to add product to a bundle",
    "examples": {
      "languages": [
        {
          "id": "nx_MuZmXO_IJGWTR1qunJ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/bundles/{bundleReference}/products \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "8FUbf2GcoR9k9m7xeJ1Qb",
          "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 requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/bundles/{bundleReference}/products\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "LOaMGG8NpkeovzuVLHRfy",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/bundles/{bundleReference}/products\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "aNAlSUexNciVVTDEYbAf_",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/bundles/{bundleReference}/products\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "nx_MuZmXO_IJGWTR1qunJ"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n  \"bundleReference\": \"001PB4PI6KTXCYR8R4\",\n  \"carts\": [\n    {\n      \"cartReference\": \"0010K4PI6KTXCYFT82\",\n      \"active\": true,\n      \"contractReference\": \"0010C4PI6KTXCYB8R9\",\n      \"lineItems\": [\n        {\n          \"lineItemReference\": \"0010I4PI6KTEVRY8R2\",\n          \"description\": \"The first line item in the cart\",\n          \"pricing\": {\n            \"grossAmount\": 2.5,\n            \"netAmount\": 2.08,\n            \"taxAmount\": 0.42,\n            \"currency\": \"GBP\"\n          },\n          \"quantity\": 1,\n          \"productInfo\": {\n            \"title\": \"Example Product\",\n            \"productReference\": \"0010BMGYFRT04\"\n          },\n          \"customLineItemParameters\": {}\n        }\n      ]\n    }\n  ],\n  \"name\": \"Bundle #1\",\n  \"description\": \"The first bundle\",\n  \"tag\": \"A002\",\n  \"status\": \"Active\"\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\r\n            • Invalid currency provided\n"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// Not Found\r\n             • Bundle not found\r\n             • Product reference cannot be found\n"
        },
        {
          "id": "response-3-409",
          "language": "409",
          "code": "// Conflict\r\n            • Duplicate product reference\r\n            • Bundle tag already exists\r\n            • Product(s) currency does not match bundle currency\r\n            • No common product currencies found\r\n            • A product cannot be assigned to a bundle more than once.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}