2 May 2023
B2BCustomersCartsOrdersQuotesGraphQL
The new Associate Roles API provides B2B customers with the flexibility to define and manage the permissions of their Associates. The feature allows the configuration of granular permissions that provide controlled access to Business Units, Carts, Orders, Quotes, and Quote Requests. Additionally, roles can be inherited from a parent Business Unit by its children.
This feature replaces the less flexible AssociateRole enum with
Buyer and Admin values. This type alongside the roles field on Associate and AssociateDraft is now deprecated and will be completely removed on 02 August 2023.In addition to the Associate Roles API, a new set of
associate endpoints can be used to validate that an Associate has sufficient permissions on a given resource. These endpoints are available for Business Units, Carts, Orders, Quotes, and Quote Requests and perform permission evaluation checks based on an associateId.These features are part of Composable Commerce for B2B and will be subject to additional terms and pricing.
Changes:
- [API] Added Associate Roles API.
- [API] Added Associate Carts, Associate Orders, Associate Quote Requests, Associate Quotes, and Associate BusinessUnit endpoints.
- [API] Added BusinessUnitAssociateMode, AssociateRoleInheritanceMode, AssociateRoleAssignment, and AssociateRoleAssignmentDraft, InheritedAssociate, and InheritedAssociateRoleAssignment types to BusinessUnit.
- [API] Added
inheritedAssociatesandassociateModefields to BusinessUnit. - [API] Added
associateModefields to BusinessUnitDraft. - [API] Added
associateRoleAssignmentsfield to Associate and AssociateDraft. - [API] Added
associateRoleAssignmentsto MyBusinessUnitAssociateDraft. - [API] Deprecated AssociateRole enum with
AdminandBuyervalues. - [API] Deprecated
rolesandinheritedAssociatesfield on Associate and AssociateDraft. - [API] Added Associate Role Messages.
- [API] Added BusinessUnitAssociateModeChanged Message.
- [API] Added
myBusinessUnitAssociateRoleOnCreationto BusinessUnitConfiguration in Project settings. - [GraphQL API] Added the following types to the GraphQL schema:
AddAssociateRolePermission,AsAssociate,AsAssociateArgument,AssociateInheritanceMode,AssociateRole,AssociateRoleAssignment,AssociateRoleAssignmentDraft,AssociateRoleBuyerAssignableChanged,AssociateRoleCreated,AssociateRoleDeleted,AssociateRoleDraft,AssociateRoleNameSet,AssociateRolePermissionAdded,AssociateRolePermissionRemoved,AssociateRolePermissionsSet,AssociateRoleQueryResult,AssociateRoleUpdateAction,BusinessUnitAssociateMode,BusinessUnitAssociateModeChanged,ChangeAssociateRoleBuyerAssignable,ChangeBusinessUnitAssociateMode,InheritedAssociate,InheritedAssociateRoleAssignment,Permission,RemoveAssociateRolePermission,SetAssociateRoleCustomField,SetAssociateRoleCustomType,SetAssociateRoleName,SetAssociateRolePermissions,SetProjectSettingsMyBusinessUnitAssociateRoleOnCreation. - [GraphQL API] Changed the
BusinessUnitDrafttype:- Input field
associateModewas added toBusinessUnitDrafttype
- Input field
- [GraphQL API] Changed the
BusinessUnittype:- Added the
inheritedAssociatesfield to theBusinessUnittype. - Added the
associateModefield to theBusinessUnittype.
- Added the
- [GraphQL API] Changed the
Associatetype:- Added the
associateRoleAssignmentsfield to theAssociatetype. - Field
roleswas deprecated inAssociatetype
- Added the
- [GraphQL API] Changed the
AssociateDrafttype:- Input field
associateRoleAssignmentswas added toAssociateDrafttype - Input field
roleswas deprecated inAssociateDrafttype
- Input field
- [GraphQL API] Changed the
BusinessUnitConfigurationtype:- Added the
myBusinessUnitAssociateRoleOnCreationfield to theBusinessUnitConfigurationtype. - Added the
myBusinessUnitAssociateRoleOnCreationReffield to theBusinessUnitConfigurationtype.
- Added the
- [GraphQL API]
SimpleAssociateRoletype was deprecated - [GraphQL API] Changed the
Querytype:- Added the
asAssociatefield to theQuerytype. - Added the
associateRolefield to theQuerytype. - Added the
associateRolesfield to theQuerytype.
- Added the
- [GraphQL API] Changed the
Mutationtype:- Argument
asAssociatewas added toMutation.updateBusinessUnitfield - Added the
updateAssociateRolefield to theMutationtype. - Argument
asAssociatewas added toMutation.createOrderFromCartfield - Argument
asAssociatewas added toMutation.deleteCartfield - Argument
asAssociatewas added toMutation.createBusinessUnitfield - Argument
asAssociatewas added toMutation.updateQuoteRequestfield - Argument
asAssociatewas added toMutation.createOrderFromQuotefield - Argument
asAssociatewas added toMutation.createCartfield - Argument
asAssociatewas added toMutation.updateOrderfield - Added the
deleteAssociateRolefield to theMutationtype. - Argument
asAssociatewas added toMutation.updateQuotefield - Argument
asAssociatewas added toMutation.createQuoteRequestfield - Added the
createAssociateRolefield to theMutationtype. - Argument
asAssociatewas added toMutation.updateCartfield
- Argument
- [GraphQL API] Changed the
ProjectSettingsUpdateActiontype:- Input field
setMyBusinessUnitAssociateRoleOnCreationwas added toProjectSettingsUpdateActiontype
- Input field
- [GraphQL API] Changed the
BusinessUnitUpdateActiontype:- Input field
changeAssociateModewas added toBusinessUnitUpdateActiontype
- Input field
The following changes were introduced in terms of GraphQL SDL:
extend type Query {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
asAssociate(businessUnitKey: KeyReferenceInput!, associateId: String!): AsAssociate!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRole(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): AssociateRole
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRoles(where: String, sort: [String!], limit: Int, offset: Int): AssociateRoleQueryResult!
}
extend type BusinessUnit {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateMode: BusinessUnitAssociateMode
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
inheritedAssociates: [InheritedAssociate!]
}
extend type Associate {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRoleAssignments: [AssociateRoleAssignment!]
}
extend type Mutation {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
createAssociateRole(draft: AssociateRoleDraft!): AssociateRole
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
deleteAssociateRole(version: Long!, personalDataErasure: Boolean = false,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): AssociateRole
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
updateAssociateRole(version: Long!, actions: [AssociateRoleUpdateAction!]!,
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): AssociateRole
}
extend type BusinessUnitConfiguration {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
myBusinessUnitAssociateRoleOnCreation: AssociateRole
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
myBusinessUnitAssociateRoleOnCreationRef: KeyReference
}
extend input BusinessUnitDraft {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateMode: BusinessUnitAssociateMode
}
extend input AssociateDraft {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRoleAssignments: [AssociateRoleAssignmentDraft!]
}
extend input ProjectSettingsUpdateAction {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
setMyBusinessUnitAssociateRoleOnCreation: SetProjectSettingsMyBusinessUnitAssociateRoleOnCreation
}
extend input BusinessUnitUpdateAction {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
changeAssociateMode: ChangeBusinessUnitAssociateMode
}
input AddAssociateRolePermission {
permission: Permission!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type AsAssociate implements CartQueryInterface & OrderQueryInterface & QuoteQueryInterface & QuoteRequestQueryInterface {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
cart(id: String!): Cart
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
carts(where: String, sort: [String!], limit: Int, offset: Int): CartQueryResult!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
order(
"Queries with specified ID"
id: String, orderNumber: String): Order
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
orders(where: String, sort: [String!], limit: Int, offset: Int): OrderQueryResult!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
quoteRequest(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): QuoteRequest
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
quoteRequests(where: String, sort: [String!], limit: Int, offset: Int): QuoteRequestQueryResult!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
quote(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): Quote
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
quotes(where: String, sort: [String!], limit: Int, offset: Int): QuoteQueryResult!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnit(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String): BusinessUnit
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
businessUnits(where: String, sort: [String!], limit: Int, offset: Int): BusinessUnitQueryResult!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AsAssociateArgument {
businessUnitKey: KeyReferenceInput!
associateId: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum AssociateInheritanceMode {
Disabled
Enabled
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type AssociateRole implements Versioned {
key: String!
buyerAssignable: Boolean!
name: String
permissions: [Permission!]!
custom: CustomFieldsType
id: String!
version: Long!
createdAt: DateTime!
lastModifiedAt: DateTime!
createdBy: Initiator
lastModifiedBy: Initiator
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type AssociateRoleAssignment {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRoleRef: KeyReference
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRole: AssociateRole!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
inheritance: AssociateInheritanceMode
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AssociateRoleAssignmentDraft {
associateRole: ResourceIdentifierInput!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
inheritance: AssociateInheritanceMode
}
type AssociateRoleBuyerAssignableChanged implements MessagePayload {
buyerAssignable: Boolean!
type: String!
}
type AssociateRoleCreated implements MessagePayload {
associateRole: AssociateRole!
type: String!
}
type AssociateRoleDeleted implements MessagePayload {
type: String!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AssociateRoleDraft {
key: String!
name: String
buyerAssignable: Boolean!
permissions: [Permission!]
custom: CustomFieldsDraft
}
type AssociateRoleNameSet implements MessagePayload {
name: String
type: String!
}
type AssociateRolePermissionAdded implements MessagePayload {
permission: Permission!
type: String!
}
type AssociateRolePermissionRemoved implements MessagePayload {
permission: Permission!
type: String!
}
type AssociateRolePermissionsSet implements MessagePayload {
permissions: [Permission!]
type: String!
}
type AssociateRoleQueryResult {
offset: Int!
count: Int!
total: Long!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
exists: Boolean!
results: [AssociateRole!]!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input AssociateRoleUpdateAction {
addPermission: AddAssociateRolePermission
changeBuyerAssignable: ChangeAssociateRoleBuyerAssignable
removePermission: RemoveAssociateRolePermission
setCustomField: SetAssociateRoleCustomField
setCustomType: SetAssociateRoleCustomType
setName: SetAssociateRoleName
setPermissions: SetAssociateRolePermissions
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum BusinessUnitAssociateMode {
Explicit
ExplicitAndFromParent
}
type BusinessUnitAssociateModeChanged implements MessagePayload {
associateMode: BusinessUnitAssociateMode!
oldAssociateMode: BusinessUnitAssociateMode
type: String!
}
input ChangeAssociateRoleBuyerAssignable {
buyerAssignable: Boolean!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input ChangeBusinessUnitAssociateMode {
associateMode: BusinessUnitAssociateMode!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type InheritedAssociate {
associateRoleAssignments: [InheritedAssociateRoleAssignment!]!
customerRef: Reference
customer: Customer
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type InheritedAssociateRoleAssignment {
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRoleRef: KeyReference!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
associateRole: AssociateRole!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
sourceRef: KeyReference!
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
source: BusinessUnit!
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
enum Permission {
CreateMyOrdersFromMyQuotes
CreateMyQuoteRequestsFromMyCarts
CreateMyCarts
CreateOrdersFromOthersCarts
DeclineOthersQuotes
UpdateMyCarts
ViewOthersQuotes
RenegotiateMyQuotes
UpdateParentUnit
CreateOthersCarts
UpdateBusinessUnitDetails
AcceptMyQuotes
RenegotiateOthersQuotes
UpdateOthersCarts
DeleteOthersCarts
DeclineMyQuotes
ViewMyCarts
AddChildUnits
DeleteMyCarts
UpdateAssociates
AcceptOthersQuotes
ViewOthersOrders
ViewOthersCarts
UpdateMyQuoteRequests
CreateQuoteRequestsFromOthersCarts
ViewMyQuotes
ViewMyQuoteRequests
CreateMyOrdersFromMyCarts
UpdateOthersOrders
UpdateMyOrders
ViewOthersQuoteRequests
CreateOrdersFromOthersQuotes
ViewMyOrders
UpdateOthersQuoteRequests
}
input RemoveAssociateRolePermission {
permission: Permission!
}
input SetAssociateRoleCustomField {
name: String!
value: String
}
input SetAssociateRoleCustomType {
fields: [CustomFieldInput!]
type: ResourceIdentifierInput
typeKey: String
typeId: String
}
input SetAssociateRoleName {
name: String
}
input SetAssociateRolePermissions {
permissions: [Permission!]
}
"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
input SetProjectSettingsMyBusinessUnitAssociateRoleOnCreation {
associateRole: ResourceIdentifierInput
}