代码之家  ›  专栏  ›  技术社区  ›  Grokify Milad

RingCentral Meetings API错误-“用户需要对请求的资源拥有[会议]权限”

  •  1
  • Grokify Milad  · 技术社区  · 6 年前

    我已经创建了一个用于阅读会议列表的应用程序,虽然我已为设置了权限,但我在下面收到了此错误 Meetings .

    应用程序编程接口:

    GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/meeting
    

    错误:

    {
      "errorCode":"CMN-408",
      "message":"In order to call this API endpoint, user needs to have [Meetings] permission for requested resource.",
      "errors":[
        {
          "errorCode":"CMN-408",
          "message":"In order to call this API endpoint, user needs to have [Meetings] permission for requested resource.",
          "permissionName":"Meetings"
        }
      ],
      "permissionName":"Meetings"
    }
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   Grokify Milad    6 年前

    用户与应用程序权限

    当应用程序通过RESTAPI请求访问用户资源(如会议)时,它使用与应用程序和授权应用程序的用户关联的访问令牌。API可能需要应用程序和用户权限。当权限返回时出现错误 user needs to have 如下所示,表示需要用户权限。

    要调用此API端点,用户需要拥有[meetings]权限\
    请求的资源。
    

    解决此问题有三个组件:

    1. 检查用户权限
    2. 查找权限的显示名称
    3. 向用户添加权限
      1. 1.检查用户权限

        括号内的文本是permissionID。您可以通过如下方式调用权限检查API来检查您的用户是否具有此权限:

        get/restapi/v1.0/account/~/extension/~/authz profile/check?permissionID=会议
        

        您将得到如下响应。根据用户是否具有特定权限,successfulproperty将显示truefalse如果您看到此错误,successfulshould be set tofalse

        。{
        “uri”:“https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/2222222/authz-profile/check?permissionID=meetings&targetExtensionID=11111111“,
        “成功”:正确,
        “详细信息”:。{
        “权限”:。{
        “uri”:“https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/meetings”,
        “id”:“会议”,
        “可转让”:正确,
        “readonly”:错误,
        “siteCompatible”:“独立”
        },请
        “effectiverole”:中的{
        “uri”:“https://platform.ringcentral.com/restapi/v1.0/dictionary/user role/3”,
        “id”:“3”
        },请
        “范围”:。[
        “自我”
        ]
        }
        }
        
        • 参考:https://developer.ringcentral.com/api docs/latest/index.html!#refcheck用户权限
          • 2.查找权限的显示名称

            若要将此权限添加到用户,需要获取将用于通过联机帐户门户添加此权限的显示名称(https://service.ringcentral.comfor production)。

            您可以通过调用权限的字典端点来获取此信息,其中permissionIDismeetingsas shown below.

            get/restapi/v1.0/dictionary/permission/permissionID_
            获取/restapi/v1.0/dictionary/permission/meetings
            

            响应将具有一个displaynameproperty,指示“会议应用程序访问”是联机帐户门户中的用户界面权限。

            或者,您可以进行API调用以获取权限列表,并查找permissionIDwhich ismeetingshere。在下面的响应摘要中,“displayname”:“meetings app access”is set for“id”:“meetings”

            get/restapi/v1.0/dictionary/permission
            

            您将得到如下响应。为了简洁起见,我删除了所有其他权限:

            。{
            “uri”:“https://platform.ringcentral.com/restapi/v1.0/dictionary/permission?page=1&perpage=100“,
            “记录”:。[
            {
            “uri”:“https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/meetings”,
            “id”:“会议”,
            “displayname”:“会议应用程序访问”,
            “可转让”:正确,
            “readonly”:错误,
            “sitecompatible”:“独立”,
            “类别”:。{
            “uri”:“https://platform.ringcentral.com/restapi/v1.0/dictionary/permission category/meetings”,
            “id”:“会议”
            },请
            “included权限”:。[
            
            ]
            }
            ]
            }
            
            • 参考:https://developer.ringcentral.com/api docs/latest/index.html!#refDictionaryPermissionList.html
              • 3.向用户添加权限

                现在转到RingCentral在线帐户门户,确保用户在其角色中具有此权限。

                在线帐户门户位于:

                • 生产环境:https://service.ringcentral.com
                • 沙盒环境:https://service.devtest.ringcentral.com
                  • 登录后,使用以下说明查找用户的角色并确保该角色具有“会议应用程序访问”权限:

                    • 知识库:i如何设置用户角色和权限?如何将特定角色分配给用户?
                      • 在用户界面中,它将如下所示:

                        它与授权应用程序的应用程序和用户都关联。API可能需要应用程序和用户权限。当权限返回时出现错误user needs to have如下图所示,这意味着需要用户权限。

                        In order to call this API endpoint, user needs to have [Meetings] permission \
                        for requested resource.
                        

                        解决此问题有三个部分:

                        1. 检查用户权限
                        2. 查找权限的显示名称
                        3. 向用户添加权限

                        1.正在检查用户权限

                        括号内的文本是permissionId.您可以通过如下方式调用权限检查API来检查您的用户是否具有此权限:

                        GET /restapi/v1.0/account/~/extension/~/authz-profile/check?permissionId=Meetings
                        

                        您将得到如下响应。这个successful属性将显示truefalse取决于用户是否具有特定权限。如果您看到这个错误,成功的应设置为错误.

                        {
                          "uri":"https://platform.ringcentral.com/restapi/v1.0/account/11111111/extension/22222222/authz-profile/check?permissionId=Meetings&targetExtensionId=11111111",
                          "successful":true,
                          "details":{
                            "permission":{
                              "uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/Meetings",
                              "id":"Meetings",
                              "assignable":true,
                              "readOnly":false,
                              "siteCompatible":"Independent"
                            },
                            "effectiveRole":{
                              "uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/user-role/3",
                              "id":"3"
                            },
                            "scopes":[
                              "Self"
                            ]
                          }
                        }
                        

                        2.第二步。查找权限的显示名称

                        若要将此权限添加到用户,需要获取将用于通过联机帐户门户添加此权限的权限的显示名称。(https://service.ringcentral.com用于生产)。

                        您可以通过调用权限的字典端点来获取此信息,其中许可IDMeetings如下图所示。

                        GET /restapi/v1.0/dictionary/permission/{permissionId}
                        GET /restapi/v1.0/dictionary/permission/Meetings
                        

                        响应将有一个displayName表示“会议应用程序访问”的属性是联机帐户门户中的用户界面权限。

                        或者,您可以进行API调用以获取权限列表并查找许可ID哪个是会议在这里。在下面的回复摘录中,"displayName":"Meetings App Access"设置为"id":"Meetings".

                        GET /restapi/v1.0/dictionary/permission
                        

                        您将得到如下响应。为了简洁起见,我删除了所有其他权限:

                        {
                          "uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission?page=1&perPage=100",
                          "records":[
                            {
                              "uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission/Meetings",
                              "id":"Meetings",
                              "displayName":"Meetings App Access",
                              "assignable":true,
                              "readOnly":false,
                              "siteCompatible":"Independent",
                              "category":{
                                "uri":"https://platform.ringcentral.com/restapi/v1.0/dictionary/permission-category/Meetings",
                                "id":"Meetings"
                              },
                              "includedPermissions":[
                        
                              ]
                            }
                          ]
                        }
                        

                        三。向用户添加权限

                        现在转到RingCentral在线帐户门户,并确保用户在其角色中具有此权限。

                        在线帐户门户位于:

                        登录后,使用以下说明查找用户的角色并确保该角色具有“会议应用程序访问”权限:

                        在用户界面中,它将如下所示:

                        enter image description here