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 Install the Company account Glue API.
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 company 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: Retrieve all the 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: retrieve a company role with the unique identifier
{
"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: retrieve a company role with the unique identifier and include the related 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"
}
}
]
}
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
company-roles |
name |
String |
Company role name. |
company-roles |
isDefault |
Boolean |
Indicates if the company role is default role for the company. |
RESOURCE |
ATTRIBUTE |
TYPE |
DESCRIPTION |
companies |
name |
String |
Specifies the company name. |
companies |
isActive |
Boolean |
Indicates whether the company is active. |
companies |
status |
String |
Specifies the status of the company. Possible values: 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. Select the current company user with /company-user-access-tokens to access the resource collection. |
To view generic errors that originate from the Glue Application, see Reference information: GlueApplication errors.
Next steps