Add Users to the Hub
Key learnings
By the end of this task, you will be able to add users to a Hub using their email ID.
Prerequisite Task
To complete the current task, you need to complete Get Hubs task.
Queries used in this task
You will use the following queries in this task:
Type | Operation | Description |
---|---|---|
mutations | addUsersToHub | Add Users To a Hub. |
Step 1 - Add users to the Hub
The addUsersToHub mutation returns an AddUsersToHubPayload object.
- In the Manufacturing Data Model Explorer, enter the following query in the Query Pane :
Query
mutation addUsersToHubTest($input: AddUsersToHubInput!) {
addUsersToHub(input: $input) {
hub {
name
projects {
results {
name
}
}
}
}
}
Show More
- In the Query Variables Pane, take note of the ID of the hub you got in Task 1. Then, simply copy and paste that ID as the value for the
hubId
in the Query variable Pane. - In the Query Variables Pane, enter the email ID of the user(s) desirous of being added to the hub.
Query Variables
{ "input": { "hubId": "a.YnVzaW5lc3M6YXV0b2Rlc2syMDA2", "userEmails": ["TestUser_IdPR_60600C092E_Test@mailinator.com"] } }
- Click Play. The response will show a list of added hubs with the users name.
Response
{ "data": { "addUsersToProject": { "project": { "name": "project test", "rootFolder": { "name": "project test", "hub": { "name": "L2-JohnDoer-HUB-TEST" } } } } } }
Show More