Business Teams Service GraphQL example mutations

You can use mutations to create, replace, or delete teams. Mutations should always use the POST API.

See the following examples of GraphQL mutations:

Creating a new team

The following is an unformatted example payload that creates a new team:

{
    "query" : "mutation { createTeam(team: { displayName: \"ABC\", distinguishedName: \"cn=abc,ou=bpm,dc=example,dc=com\", description: ...   }) { uuid displayName distinguishedName description ... } } "
}

Note: Because the value of the query field is a string that contains the GraphQL query, all quotes inside the GraphQL query must be escaped.

The following is a query string (excluding the "query":) of another example in clear formatted text:

mutation {
    createTeam(
        team: {
            displayName: "ABC",
            distinguishedName: "cn=abc,ou=bpm,dc=example,dc=com",
            description: "Desc",
            users: [
                "U1"
            ],
            teams: [
                "5183d3c6-d25e-4fe7-847e-8b2bd5a0e1d0"
            ]
        }
    ) {
        uuid
        displayName
        distinguishedName
        description
        users
        groups
        teams {
            uuid
        }
    }
}

An example of a response:

{
    "data": {
        "createTeam": {
            "uuid": "9b62c908-b356-4de2-b784-527a782649dd",
            "displayName": "ABC",
            "distinguishedName": "cn=abc,ou=bpm,dc=example,dc=com",
            "description": "Desc",
            "groups": [],
            "teams": [
                {
                    "uuid": "5183d3c6-d25e-4fe7-847e-8b2bd5a0e1d0"
                }
            ],
            "users": [
                "U1"
            ]
        }
    }
}

Replacing a team

The following is an example query string to replace a team in clear text:

mutation {
    replaceTeam(
        uuid: "9b62c908-b356-4de2-b784-527a782649dd",
        team: {
            displayName: "DEF",
            distinguishedName: "cn=def,ou=bpm,dc=example,dc=com",
            users: [
                "U2", "U3"
            ],
            teams: [
                "936783c6-d24e-41f1-217e-1a3cd4a1e201"
            ]
        }
    ) {
         uuid
        displayName
        distinguishedName
        description
        users
        groups
        teams {
            uuid
            displayName
            description
            teams {
                uuid
                teams {
                    uuid
                    teams {
                        uuid
                        teams {
                            uuid
                            teams {
                                uuid
                                teams {
                                    uuid
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

Note: In the previous example, the nesting of the teams illustrates how it is possible to query the result arbitrarily deep in the relationship nesting.

Deleting a team

The following is an example query string to delete a team in clear text:

mutation {
    deleteTeam(
        uuid: "9b62c908-b356-4de2-b784-527a782649dd"
    )
}

An example of a response:

{
    "data": {
        "deleteTeam": "9b62c908-b356-4de2-b784-527a782649dd"
    }
}