Overview
You are looking for instructions on how to Create a Cognito user for your Totogi Tenant using the GraphQL API.
Solution
In order to make the requests through the API, the information below is required.
- The Provider ID.
- An Access Token using the credentials from the Tenant Admin User.
In order to create a new Cognito user, one should use the createUser mutation API call. With this method, one can create a Cognito user passing some of the parameters mentioned in the API definition.
Below is an example payload to create a Cognito user with Tenant admin roles with some important specifications:
- The name of the user(name) is mandatory input and should be between 2 and 75 characters.
- The email address should be in the format local-part@domain-part as defined by RFC 822.
- The user ID returned will be the email ID that was passed by default.
- The Role group definition has the possible values for the roleGroupMemberships input parameter.
- The job title(jobTitle) is an optional input parameter and if passed it should be at least two characters long and a maximum of fifty
- The request handles different possible results such as what to return if the UserAlreadyExists or on InvalidField was passed.
mutation CreateUser {
createUser(input:
{providerId : "<Provider ID>",
email: "<email@domain>",
name: "<Name>",
roleGroupMemberships: [Plan_Admin,
Plan_Publisher,
Plan_Designer],
jobTitle: "<Job Title>"
}
) {
... on SaveUserPayload {
providerId,
userId,
email ,
name,
jobTitle,
roleGroupMemberships
}
... on UserAlreadyExists {
errorMessage
errorCode
email
}
... on InvalidField {
errorMessage
errorCode
fieldName
}
}
}
The result (if the User is successfully created) is the User information along with user roles as shown below: