User Role
A User Role represents the role a user has for a specific resource or resource type.
A role represents a collection of permissions (see Role).
Resource URIs
- Item URI:
/v7.1/user_role/{pk}/
- Collection URI:
/v7.1/user_role/
Item
Item Methods
GET
Retrieve a User Role by idDELETE
Delete a User Role by id
Item links
self
A link to this resourceuser
A link to the User resource that owns the User Rolerole
The assigned role.resource
The resource this role applies to.
Collection
Collection methods
POST
Set or update a role for a user on a resource. Requesting user must have themanage_roles
permission on the specified resource.
Collection query parameters
Name | Description | Type | Required |
---|---|---|---|
resource |
The path of the resource you want to see roles for (e.g. /page/123/ ). |
string | Required unless user_id is provided. |
user_id |
The ID of the user whose roles you wish to have returned. | string | Required unless resource is provided. |
Usage
GET User Role entity
Request GET: /v7.1/user_role/24578713_page_association_16/
Response
{
"_links": {
"resource": [
{
"href": "/page_association/16/"
}
],
"self": [
{
"href": "/api/v7.1/user_role/24578713_page_association_16/",
"id": "24578713_page_association_16"
}
],
"documentation": [
{
"href": "https://developer.mapmyfitness.com/docs/v71_User_Role/"
}
],
"role": [
{
"href": "/api/v7.1/role/administrator/",
"id": "administrator"
}
],
"user": [
{
"href": "/v7.1/user/24578713/",
"id": "24578713"
}
],
}
}
POST User Role entity
Request POST: /v7.1/user_role/
{
"user": "1234",
"resource": "/api/v7.1/page/1234/",
"role": "/api/v7.1/role/administrator/"
}
Response
{
"user": "1234",
"resource": "/api/v7.1/page/1234/",
"role": "/api/v7.1/role/administrator/"
}
DELETE User Role entity
Request DELETE: /v7.1/user_role/24578713_page_association_16/
Response
204 No Content