SAP Knowledge Base Article - Public

3341990 - Create a Dynamic Groups using the OData API

Symptom

You wish to know whether it's possible to CREATE Dynamic Groups via OData API.

Resolution

To CREATE Dynamic Groups via OData API you should perform a upsert such as below:

OperationUpsert
HTTP MethodPOST
URIhttps://<API-Server>/odata/v2/upsert
Payload
{
    "__metadata": {
        "uri": "DynamicGroup"
    },
    "groupType": "permission",
    "dgIncludePools": [
        {
            "__metadata": {
                "uri": "DGPeoplePool"
            },
            "peoplePoolId": "3600_1",
            "filters": [
                {
                    "__metadata": {
                        "uri": "DGFilter"
                    },
                    "expressions": [
                        {
                            "__metadata": {
                                "uri": "DGExpression"
                            },
                            "operator": {
                                "__metadata": {
                                    "uri": "DGFieldOperator"
                                },
                                "token": "eq"
                            },
                            "values": [
                                {
                                    "__metadata": {
                                        "uri": "DGFieldValue"
                                    },
                                    "fieldValue": "UserA"
                                }
                            ]
                        },
                        {
                            "__metadata": {
                                "uri": "DGExpression"
                            },
                            "operator": {
                                "__metadata": {
                                    "uri": "DGFieldOperator"
                                },
                                "token": "eq"
                            },
                            "values": [
                                {
                                    "__metadata": {
                                        "uri": "DGFieldValue"
                                    },
                                    "fieldValue": "UserB"
                                }
                            ]
                        },
                        {
                            "__metadata": {
                                "uri": "DGExpression"
                            },
                            "operator": {
                                "__metadata": {
                                    "uri": "DGFieldOperator"
                                },
                                "token": "eq"
                            },
                            "values": [
                                {
                                    "__metadata": {
                                        "uri": "DGFieldValue"
                                    },
                                    "fieldValue": "UserC"
                                }
                            ]
                        },
                        {
                            "__metadata": {
                                "uri": "DGExpression"
                            },
                            "operator": {
                                "__metadata": {
                                    "uri": "DGFieldOperator"
                                },
                                "token": "eq"
                            },
                            "values": [
                                {
                                    "__metadata": {
                                        "uri": "DGFieldValue"
                                    },
                                    "fieldValue": "UserX"
                                }
                            ]
                        }
                    ],
                    "field": {
                        "__metadata": {
                            "uri": "DGField"
                        },
                        "name": "std_username",
                        "allowedOperators": {
                            "__metadata": {
                                "uri": "DGFieldOperator"
                            },
                            "token": "eq"
                        }
                    }
                }
            ]
        }
    ]
}

It's important to keep in mind that the method to CREATE a Dynamic Group via API is basically the same as UPDATING Dynamic Groups, but you MUST remove the groupId from the Request Body. This will make API create a new Dynamic Group instead of updating it.

See Also

DynamicGroup

Keywords

dynamic group, groupId, odata, create , KBA , LOD-SF-INT-ODATA , OData API Framework , Problem

Product

SAP SuccessFactors HCM Suite all versions