---
title: Allows adding contract frequencies to be attached to a bundle
slug: docs/demo/allows-adding-contract-frequencies-to-be-attached-to-a-bundle
description: Learn how to make a POST request to a specific endpoint using curl with this comprehensive code example. This document shows you how to include headers for handling JSON data and how to provide contract details through the data field. Improve your API dev
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "Mj5OPpb6rPKitV4Bn5SbJ",
  "data": {
    "url": "https://api.fictive.com/REST/api/bundles/{bundleReference}/contracts",
    "name": "Allows adding contract frequencies to be attached to a 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": "contractReferences",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "contracts",
              "type": "array",
              "example": [],
              "itemType": "string",
              "customType": "string[]",
              "description": "The available contracts as a list of references",
              "itemExample": ""
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleContractInfo",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.Bundle.BundleContractInfo",
          "isExpanded": true,
          "description": "DTO object for the Bundle Contracts"
        }
      ],
      "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\": \"0010B4PI6KTXCYR8R4\"\n          },\n          \"customLineItemParameters\": {}\n        }\n      ]\n    }\n  ],\n  \"name\": \"Fifth Bundle (With Tag & Cart)\",\n  \"description\": \"The fifth bundle, featuring a tag & single cart\",\n  \"tag\": \"A005\",\n  \"status\": \"Active\"\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not found\r\n            <br />• Bundle cannot be found.\r\n            <br />• Contract cannot be found.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "409",
        "description": "Conflict\r\n            <br />• A contract cannot be assigned to a bundle more than once.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "412",
        "description": "Precondition Failed\r\n            <br />• A minimum of one product is required in a bundle before a contract can be assigned.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will allow you to add contract frequencies to be attached to a bundle",
    "examples": {
      "languages": [
        {
          "id": "QAY8n4kHE-Qb5i-0zek8Z",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/bundles/{bundleReference}/contracts \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "cRgLmwT7Rg_ukNgwG_c8p",
          "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}/contracts\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "rmVMwx2s5KcKRi1Sy80Wu",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/bundles/{bundleReference}/contracts\")\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": "1OrzDA6TD4CMrbmJtFmeh",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/bundles/{bundleReference}/contracts\"\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": "QAY8n4kHE-Qb5i-0zek8Z"
    },
    "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\": \"0010B4PI6KTXCYR8R4\"\n          },\n          \"customLineItemParameters\": {}\n        }\n      ]\n    }\n  ],\n  \"name\": \"Fifth Bundle (With Tag & Cart)\",\n  \"description\": \"The fifth bundle, featuring a tag & single cart\",\n  \"tag\": \"A005\",\n  \"status\": \"Active\"\n}"
        },
        {
          "id": "response-1-404",
          "language": "404",
          "code": "// Not found\r\n            • Bundle cannot be found.\r\n            • Contract cannot be found.\n"
        },
        {
          "id": "response-2-409",
          "language": "409",
          "code": "// Conflict\r\n            • A contract cannot be assigned to a bundle more than once.\n"
        },
        {
          "id": "response-3-412",
          "language": "412",
          "code": "// Precondition Failed\r\n            • A minimum of one product is required in a bundle before a contract can be assigned.\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}