---
title: Assign an existing subscription to a group
slug: docs/demo/assign-an-existing-subscription-to-a-group
description: Learn how to make a PATCH request to the fictive.com API effortlessly with this code example. Discover the essential headers and data needed for a successful request. Boost your API integration skills and streamline your development process.
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "YWkZiCepHenzHw_gihwAu",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/groups/subscriptions/{subscriptionId}",
    "name": "Assign an existing subscription to a group",
    "method": "PATCH",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "type": "string",
          "description": "The account reference identifier"
        },
        {
          "kind": "required",
          "name": "subscriptionId",
          "type": "integer",
          "description": "The subscription id identifier"
        }
      ],
      "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": "dto",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "accountGroupToken",
              "type": "string",
              "example": "",
              "description": "The account group token."
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.AddSubscriptionToGroupAccountRequest",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.AddSubscriptionToGroupAccountRequest",
          "isExpanded": true,
          "description": "DTO for AddSubscriptionToGroupAccountRequest."
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "204",
        "description": "No Content",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "Calling this endpoint allows the subscription previously purchased by an individual to be assigned to a group.",
    "examples": {
      "languages": [
        {
          "id": "TpcBZYbHlzNcaR9tDtDqp",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/groups/subscriptions/{subscriptionId} \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "olWrmg9PuP7veM6U7jB-K",
          "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: 'PATCH',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/{accountReference}/groups/subscriptions/{subscriptionId}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "EUB8W3L20ynmR9K94QDU8",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/{accountReference}/groups/subscriptions/{subscriptionId}\")\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\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "XC5mEoZQ482hOrm6rJR5y",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/groups/subscriptions/{subscriptionId}\"\n\npayload = {}\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": "TpcBZYbHlzNcaR9tDtDqp"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-204",
          "language": "204",
          "code": "// No Content\n"
        }
      ],
      "selectedLanguageId": "response-0-204"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}