Access Management
API

Access Management API

Introduction

ROQ Platform provides access management API to easily get and apply the access and permission data for the user application. Please refer to the access management for feature guides, tutorials, and more information.

Queries

ℹ️

Before you can use these APIs, please install the ROQ's Node.js SDK

role()

ROQ provides the role() (opens in a new tab) API to get the role for the specific role id. For example, to get the role with the role id 8f8a676b-7dea-4a06-a249-55e7f899aeeb

const roleData = await roqClient.asSuperAdmin().role({
	id: "8f8a676b-7dea-4a06-a249-55e7f899aeeb", withUserCount: true
})

The output for the code example above is a simple JavaScript object:

{
  role: {
    id: '8f8a676b-7dea-4a06-a249-55e7f899aeeb',
    reference: null,
    description: '',
    isSystemManaged: false,
    key: 'channel-owner',
    name: 'Channel Owner',
    users: { totalCount: 1 }
  }
}
ParameterTypeDescription
idstringThe role id
withUserCountbooleanWhether to include the user count or not

roles()

The roles() (opens in a new tab) API will return all the available roles on the ROQ Platform. You can filter roles based on the key and limit the result.

const rolesData = await roqClient.asSuperAdmin().roles({
	limit: 10,
	withUserCount: true,
  filter: {
	    key: {
        like: "mar%"
      }
  }
})
ParameterTypeDescription
limitintegerLimit the results
withUserCountbooleanInclude the user count for this role
filterobjectFilter the result

Mutations

ℹ️

Before you can use these APIs, please install the ROQ's Node.js SDK

assignRolesToUser()

The assignRolesToUser() (opens in a new tab) API will assign a role or roles to a user.

const assignStatus = await roqClient.asSuperAdmin().assignRolesToUser({
	userId: "7877d2d0-dea7-473e-a158-57eca3123906",
	roleKeys: [" channel-owner", "marketing"]
})
ParameterTypeDescription
userIdstringThe user id which roles to be applied
roleKeysarrayKey roles

unassignRolesFromUser()

The unassignRolesFromUser() (opens in a new tab) will unassign a role or roles from the user.

const unassignStatus = await roqClient.asSuperAdmin().unassignRolesFromUser({
	userId: "7877d2d0-dea7-473e-a158-57eca3123906",
	roleKeys: ["marketing"]
})
ParameterTypeDescription
userIdstringThe user id which a role or roles to be removed
roleKeysarrayKey roles

queryPlans()

The queryPlans() (opens in a new tab) API method will get the query plans from the ROQ Platform.

const queryPlans = await roqClient.asSuperAdmin().queryPlans()