Manage company structures
Magento Commerce for B2B allows company users to be assigned to company teams and hierarchies.
Manage company teams
Company teams allow you to group company users by location, job responsibilities, or any criteria you choose. You can assign individual company users to a team with the company hierarchy endpoints.
Service name
companyTeamRepositoryV1
REST Endpoints
Company team parameters
Name | Description | Format | Requirements |
---|---|---|---|
id | System-generated team ID | integer | Not applicable for create operations. |
name | The displayed name of the team | string | Required to create or update a team. |
description | An optional description of the team. | string | Optional |
Create a team
A newly-created team is placed under Company Admin in the company hierarchy.
Sample Usage
POST /V1/team/2
Payload
Response
The team ID, such as 4
.
Update a team
You can only change the name or description of a team.
Sample Usage
PUT /V1/team/4
Payload
Response
true
, indicating the request was successful
Return all information about a team
The GET
call returns the team id
, name
, and description
.
Sample Usage
GET /V1/team/4
Payload
Not applicable
Response
Delete a team
You cannot delete a team if members are assigned to it.
Sample Usage
DELETE /V1/team/4
Payload
Not applicable
Response
An empty array
Search for a team
The following query returns information about all teams (team_id
≥ 0
)
See Search using REST APIs for information about constructing a search query.
Sample Usage
GET V1/team?searchCriteria[filter_groups][0][filters][0][field]=team_id&searchCriteria[filter_groups][0][filters][0][value]=0&searchCriteria[filter_groups][0][filters][0][condition_type]=gteq
Payload
Not applicable
Response
Company hierarchies
In the B2B storefront, a buyer can view the company structure represented as a hierarchy tree. The tree can display multiple levels of company subdivisions (teams) as well as company users. The company hierarchy can have any number of items and levels.
You can use REST endpoints to retrieve the current structure and move teams and buyers within the hierarchy. You cannot delete teams or buyers.
Service name
companyHierarchyV1
REST Endpoints
Return all information about the company hierarchy
In the following example, the following company hierarchy has already been established:
Admin (structure_id = 2)
|-- East (team, structure_id = 8)
| |-- Bryce Martin (customer, structure_id = 4)
| |-- Melanie Shaw (customer, structure_id = 3)
|
|-- West (team, structure_id = 7)
| |-- Marcus Thomas (customer, structure_id = 6)
| |-- Teresa Gomez (customer, structure_id = 5)
Sample Usage
GET /V1/heirarchy/2
Payload
Not applicable
Response
Assign a new parent to teams and company users
The following example moves Bryce Martin (structure_id = 4
) to the West team (structure_id = 7
)
Sample Usage
PUT /V1/hierarchy/move/5
Payload
Response
[]
(an empty array)