Zoho crm Logo

创建用户组

目的

若要创建用户组。

端点

  • POST /settings/user_groups

请求详情

请求 URL

{api-domain}/crm/{version}/settings/user_groups

标题

授权:Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

范围

scope=ZohoCRM.settings.user_groups.CREATE

示例请求

Copiedcurl "https://www.zohoapis.com/crm/v8/settings/user_groups"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@input.json"
-X POST

输入 JSON

  • namestring,必填

    用户组的名称。接受字母数字字符。请注意,每个组的名称必须唯一。

  • descriptionstring,可选

    用户组的描述。

  • sourcesJSON array,必填

    该数组中的每个 JSON 对象包含以下键:

    • type - 字符串,必填 - 您要添加到用户组的成员类型。可用值为 users、roles、groups 和 territories。
    • source - JSON 对象,必填 - 您要添加到用户组的用户、群组、角色或辖区的 API 名称和 ID。若您的 "type" 为 "roles",此处必须仅提供该角色的详细信息。
    • subordinates - 布尔值,可选 - 当您的 "type" 为 "roles" 或 "territories" 时,此键表示您是否也将下属角色或子辖区分配给该用户组。

样例输入

Copied{
    "user_groups": [
        {
            "name": "test group",
            "description": "my group",
            "sources": [
                {
                    "source": {
                        "name": "Patricia Boyle",
                        "id": "3652397000000186017"
                    },
                    "type": "users"
                },
                {
                    "source": {
                        "name": "Manager",
                        "id": "3652397000000026008"
                    },
                    "type": "roles",
                    "subordinates": true
                },
                {
                    "source": {
                        "name": "New York",
                        "id": "3652397000007622003"
                    },
                    "type": "territories",
                    "subordinates": true
                },
                {
                    "source": {
                        "name": "Deborah Gill",
                        "id": "3652397000000281001"
                    },
                    "type": "users"
                }
            ]
        }
    ]
}

可能的错误

  • DUPLICATE_DATAHTTP 400

    组名已存在。
    解决方案:组名必须唯一。请为要创建的组指定另一个名称。

  • MANDATORY_NOT_FOUNDHTTP 400

    你的输入中未包含键 "name"。
    解决方案:"name" 是必需键。请确保为要创建的用户组提供名称。

  • INVALID_DATAHTTP 400

    角色或区域 ID 无效。
    解决方案:请参阅响应中的 "details" 键以获取具体错误,并据此进行更正。

  • NO_PERMISSIONHTTP 403

    您没有创建用户组的权限。
    解决方法:请联系您的管理员以获取 "Manage Groups" 权限,以便创建用户组。

示例响应

Copied{
    "user_groups": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "5725767000002350003"
            },
            "message": "User Group Created successfully",
            "status": "success"
        }
    ]
}