---
title: Create Sapm Groups (Bulk Create)
slug: single-connect-api-3-0-3/create-sapm-groups-bulk-create
description: Learn how to create SAPm groups using curl with this code example. Discover how to make a POST request with JSON data, including the necessary headers, in this comprehensive document. Master the art of requesting and creating SAPm groups effortlessly.
docTags: 
createdAt: 2022-11-10T14:21:49.000Z
---

{
  "id": "D4t34TYNGF5uWd5EnCAFD",
  "data": {
    "url": "{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups",
    "method": "POST",
    "request": {
      "pathParameters": [],
      "queryParameters": [],
      "headerParameters": [
        {
          "name": "X-XSRF-TOKEN",
          "type": "string",
          "example": "{{csrftoken}}",
          "description": ""
        }
      ],
      "bodyDataParameters": [
        {
          "name": "body",
          "type": "string",
          "example": "[\n\t{\n\t\"name\":\"Group2\",\n\t\"description\":\"Desc2 of Group2\",\n\t\"parentSapmGroupId\":13682\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t},\n\t{\n\t\"name\":\"Groupx\",\n\t\"description\":\"Descx\"\n\t}\n]\n",
          "description": ""
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "<p>Create Sapm Groups (Bulk Create)</p>",
        "jsonExample": "[\n    {\n        \"modelData\": {\n            \"name\": \"Group2\",\n            \"description\": \"Desc2 of Group2\",\n            \"parentSapmGroupId\": 982668\n        },\n        \"message\": \"SUCCESS\"\n    },\n    {\n        \"modelData\": {\n            \"name\": \"Groupx\",\n            \"description\": \"Descx\",\n            \"parentSapmGroupId\": null\n        },\n        \"message\": \"SUCCESS\"\n    },\n    {\n        \"modelData\": {\n            \"name\": \"Groupx\",\n            \"description\": \"Descx\",\n            \"parentSapmGroupId\": null\n        },\n        \"message\": \"A Sapm group named Groupx already exists\"\n    }\n]"
      }
    ],
    "contentType": "application/json",
    "description": "<p>You can send multiple parameters for each group you want to create. If you want to create a subgroup of another group, you should send it via \"parentSapmGroupId\" parameter. Otherwise, it will not have a parent group.</p>",
    "examples": {
      "languages": [
        {
          "id": "d_U6jpT1XHQJIYl7m1AfQ",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url {{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups \\\n     --header 'accept: application/json'"
        },
        {
          "id": "V3BiFXCK0K0GKRbAD4EFB",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "xnfDcxTq-20JIR2wAXrlx",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"net/http\"\n\nurl = URI(\"{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups\")\n\nhttp = Net::HTTP.new(url.host, url.port);\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\n\nresponse = http.request(request)\nputs response.read_body\n"
        },
        {
          "id": "joUzOMrt2uCOKFJXMbWsh",
          "language": "python",
          "label": "Python",
          "code": "import requests\n\nurl = \"{{url}}/aioc-rest-web/rest/sc/sapm/createSapmGroups\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "d_U6jpT1XHQJIYl7m1AfQ"
    },
    "results": {
      "languages": [
        {
          "id": "QER3GIMyCxn0Oog2wf74g",
          "language": "200",
          "code": "[\n    {\n        \"modelData\": {\n            \"name\": \"Group2\",\n            \"description\": \"Desc2 of Group2\",\n            \"parentSapmGroupId\": 982668\n        },\n        \"message\": \"SUCCESS\"\n    },\n    {\n        \"modelData\": {\n            \"name\": \"Groupx\",\n            \"description\": \"Descx\",\n            \"parentSapmGroupId\": null\n        },\n        \"message\": \"SUCCESS\"\n    },\n    {\n        \"modelData\": {\n            \"name\": \"Groupx\",\n            \"description\": \"Descx\",\n            \"parentSapmGroupId\": null\n        },\n        \"message\": \"A Sapm group named Groupx already exists\"\n    }\n]"
        }
      ],
      "selectedLanguageId": "QER3GIMyCxn0Oog2wf74g"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}