Role

A Role represents a collection of permissions. This resource is provided only to allow the client to display the permissions that are associated with a Role.

IMPORTANT: All authorization checks should be made by checking the user’s permission via the User Permission resource.

Resource URIs

Item URI: /vx/role/{pk}/ Collection URI: /vx/role/

Item

Item Methods

GET Retrieve a Role by id

Item properties

Name Description Type HTTP Support
permissions description of field the permissions attributed to this Role GET: required
description description of this Role text GET: required
name name of the Role text GET: required

self A link to this resource

Collection

Collection methods

GET Get a list of Roles.

Collection properties

Name Description Type HTTP Support
total_count number of Roles in the response number GET: required

self A link to this resource

Embedded collections

roles A collection of Roles with properties as described under Item properties and links as described under Item links

Usage

GET Role entity

Request GET: /vx/role/administrator/
Response
{
    "permissions": [
        "create_resource",
        "manage_roles",
        "edit_resource",
        "edit_settings",
        "create_post",
        "delete_post",
        "create_reply",
        "delete_reply"
    ],
    "_links": {
        "self": [
            {
                "href": "/api/0.1//role/?limit=20&offset=0"
            }
        ]
        "documentation": [
            {
                "href": "https://developer.mapmyfitness.com/docs/Role"
            }
        ]
    },
    "description": "Perform administrative functions and manage permissions for other users",
    "name": "administrator"
}

GET Role collection

Request GET: /vx/role/
Response
{
    "_links": {
        "self": [
            {
                "href": "\/vx\/role\/?limit=20&offset=0"
            }
        ],
        "documentation": [
            {
                "href":"https:\/\/developer.mapmyfitness.com\/docs\/Role"
            }
        ]
    },
    "_embedded": {
        "roles": [
            {
                "permissions": ["create_resource", "manage_roles", ...],
                "description": "Perform administrative functions and manage permissions for other users",
                "name":"administrator"
            }
            {
                "permissions": ["edit_resource", "edit_settings", ...],
                "description": "Perform editing functions",
                "name": "editor"
            },
            {
                "permissions": ["create_post", "delete_post", ...],
                "description": "Perform moderation functions",
                "name": "moderator"
            }
        ]
    },
    "total_count": 3
}