Retrieving company roles

Edit on GitHub

In corporate environments, where users act as company representatives rather than private buyers, companies can leverage Company Roles to distribute scopes and permissions among Company Users. This endpoint allows retrieving information about the company roles.

Installation

For detailed information on the modules that provide the API functionality and related installation instructions, see Glue API: Company Account Feature Integration.

Retrieve a company role

To retrieve a company role, send the request:


GET /company-roles/{{company_role_id}}


PATH PARAMETER DESCRIPTION
{{company_role_id}} Unique identifier of a company role to retrieve. Enter mine to retrieve the company role of the current authenticated company user.

Request

HEADER KEY TYPE REQUIRED DESCRIPTION
Authorization string String containing digits, letters, and symbols that authorize the company user. Authenticate as a company user to get the value.
QUERY PARAMETER DESCRIPTION POSSIBLE VALUES
Include Adds resource relationships to the request.
REQUEST USAGE
GET https://glue.mysprykershop.com/company-roles/mine Retrieve all the copmany roles of the current authenticated company user.
GET https://glue.mysprykershop.com/company-roles/2f0a9d3e-9e69-53eb-8518-284a0db04376 Retrieve the company role with the id 2f0a9d3e-9e69-53eb-8518-284a0db04376.
GET https://glue.mysprykershop.com/company-roles/2f0a9d3e-9e69-53eb-8518-284a0db04376?include=companies Retrieve the company role with the id 2f0a9d3e-9e69-53eb-8518-284a0db04376 with related companies included.

Response

Response sample of company roles of the current authenticated company user
{
    "data": [
        {
            "type": "company-roles",
            "id": "2f0a9d3e-9e69-53eb-8518-284a0db04376",
            "attributes": {
                "name": "Admin",
                "isDefault": true
        },
        "links": {
            "self": "https://glue.mysprykershop.com/company-roles/2f0a9d3e-9e69-53eb-8518-284a0db04376"
        }
    }
    ],
    "links": {
        "self": "https://glue.mysprykershop.com/company-roles/mine"
    }
}
Response sample of a particular company role
{
    "data": {
        "type": "company-roles",
        "id": "2f0a9d3e-9e69-53eb-8518-284a0db04376",
        "attributes": {
            "name": "Admin",
            "isDefault": true
        },
        "links": {
            "self": "https://glue.mysprykershop.com/company-roles/2f0a9d3e-9e69-53eb-8518-284a0db04376"
        }
    }
}
Response sample with companies
{
    "data": {
        "type": "company-roles",
        "id": "2f0a9d3e-9e69-53eb-8518-284a0db04376",
        "attributes": {...},
        "links": {...},
        "relationships": {
            "companies": {
                "data": [
                    {
                        "type": "companies",
                        "id": "0818f408-cc84-575d-ad54-92118a0e4273"
                    }
                ]
            }
        }
    },
    "included": [
        {
            "type": "companies",
            "id": "0818f408-cc84-575d-ad54-92118a0e4273",
            "attributes": {
                "isActive": true,
                "name": "Test Company",
                "status": "approved"
            },
            "links": {
                "self": "https://glue.mysprykershop.com/companies/0818f408-cc84-575d-ad54-92118a0e4273"
            }
        }
    ]
}
ATTRIBUTE TYPE DESCRIPTION
name String Specifies the name of the Company Role
isDefault Boolean Indicates whether the Company Role is the default role for the company.
INCLUDED RESOURCE ATTRIBUTE TYPE DESCRIPTION
companies name String Company name.
companies isActive Boolean Indicates if the company is active.
companies status String Company status. Possible values are: Pending, Approved or Denied.

Possible errors

CODE REASON
001 Authentication token is invalid.
002 Authentication token is missing.
2101 Company role is not found.
2103 Current company user is not set. You need to select the current company user with /company-user-access-tokens in order to access the resource collection.

To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.

Next steps