Create a Group for a Group

post

/api/v2/groups/{id}/children/

Make a POST request to this resource with the following group fields to create a new group associated with this group.

  • name: Name of this group. (string, required)
  • description: Optional description of this group. (string, default="")
  • inventory: (id, required)
  • variables: Group variables in JSON or YAML format. (json, default=``)

Add Groups for a Group:

Make a POST request to this resource with only an id field to associate an existing group with this group.

Remove Groups from this Group:

Make a POST request to this resource with id and disassociate fields to remove the group from this group without deleting the group.

Request

Supported Media Types
Path Parameters
Body ()
Root Schema : schema
Example:
{
    "id":"2"
}
Back to Top

Response

Supported Media Types

201 Response

Body
Example Response (application/json)
{
    "created":"2018-02-01T08:00:00.000000Z",
    "description":"Hello world",
    "id":"2",
    "inventory":"1",
    "modified":"2018-02-01T08:00:00.000000Z",
    "name":"New name",
    "related":{
        "activity_stream":"/api/v2/groups/2/activity_stream/",
        "ad_hoc_commands":"/api/v2/groups/2/ad_hoc_commands/",
        "all_hosts":"/api/v2/groups/2/all_hosts/",
        "children":"/api/v2/groups/2/children/",
        "hosts":"/api/v2/groups/2/hosts/",
        "inventory":"/api/v2/inventories/1/",
        "inventory_sources":"/api/v2/groups/2/inventory_sources/",
        "job_events":"/api/v2/groups/2/job_events/",
        "job_host_summaries":"/api/v2/groups/2/job_host_summaries/",
        "potential_children":"/api/v2/groups/2/potential_children/",
        "variable_data":"/api/v2/groups/2/variable_data/"
    },
    "summary_fields":{
        "inventory":{
            "description":"",
            "has_active_failures":false,
            "has_inventory_sources":false,
            "hosts_with_active_failures":"0",
            "id":"1",
            "inventory_sources_with_failures":"0",
            "kind":"",
            "name":"test-inv",
            "organization_id":"1",
            "total_groups":"0",
            "total_hosts":"0",
            "total_inventory_sources":"0"
        },
        "user_capabilities":{
            "copy":true,
            "delete":true,
            "edit":true
        }
    },
    "type":"group",
    "url":"/api/v2/groups/2/",
    "variables":""
}

400 Response

Body
Example Response (application/json)
{
    "error":"Cyclical Group association."
}

403 Response

Body
Example Response (application/json)
{
    "detail":"You do not have permission to perform this action."
}
Back to Top