问题
I have created an app for reading meeting list and I'm getting this error below although I have set permission for Meetings
.
API:
GET /restapi/v1.0/account/{accountId}/extension/{extensionId}/meeting
Error:
{
"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"
}
- Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefMeetingsList.html
回答1:
User vs App Permissions
When an app requests access to a user resources like Meetings via the REST API, it uses an access token which is associated with both the app and user that authorized the app. An API may require both an app and a user permission. When the permission returns with the error user needs to have
as shown below, it means the user permission is needed.
In order to call this API endpoint, user needs to have [Meetings] permission \
for requested resource.
There are three components to resolving this:
- Checking the User Permission
- Finding the Display Name of the Permission
- Adding the Permission to the User
1. Checking User Permission
The text within the brackets is the permissionId
. You can check whether your user has this permission by calling the permission check API as follows:
GET /restapi/v1.0/account/~/extension/~/authz-profile/check?permissionId=Meetings
You will get a response like the following. The successful
property will show true
or false
depending on whether the user has the specific permission. If you are seeing this error, successful
should be set to false
.
{
"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"
]
}
}
- Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefCheckUserPermissions
2. Finding the Display Name of the Permission
To add this permission to the user, it is necessary to get the Display Name of the permission which will be used in adding this permission via the Online Account Portal (https://service.ringcentral.com for production).
You can get this info by calling the permission's dictionary endpoint where permissionId
is Meetings
as shown below.
GET /restapi/v1.0/dictionary/permission/{permissionId}
GET /restapi/v1.0/dictionary/permission/Meetings
The response will have a displayName
property indicating "Meetings App Access" is the UI permission in the Online Account Portal.
Alternately, you can make an API call to get a list of permissions and look for the permissionId
which is Meetings
here. In the response excerpt below, the "displayName":"Meetings App Access"
is set for "id":"Meetings"
.
GET /restapi/v1.0/dictionary/permission
You will get a response like the following. I've removed all other permissions for brevity:
{
"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":[
]
}
]
}
- Ref: https://developer.ringcentral.com/api-docs/latest/index.html#!#RefDictionaryPermissionList.html
3. Adding the Permission to the User
Now go to the RingCentral Online Account Portal and ensure the user has this permission in their role.
The Online Account Portal is at:
- Production environment: https://service.ringcentral.com
- Sandbox environment: https://service.devtest.ringcentral.com
After you log in, use the following instructions to find the user's role and ensure the role has the "Meetings App Access" permission:
- KB: How do I set up User Roles and Permissions? How do I assign a specific role to Users?
It will look like the following in the UI:
来源:https://stackoverflow.com/questions/50977970/ringcentral-meetings-api-error-user-needs-to-have-meetings-permission-for-r