Create a user¶
Invite a user to join the current workspace. Each invitation can only use the email address or mobile phone number of the registered account, not both at the same time. Before the invitee accepts the invitation, he or she may not be able to perform subsequent member management operations.
POST $CLOUDSIGMA_API_BASE/user/create
Before you call¶
Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Determine the invitation method and prepare an identity information of the invitee. When inviting via email or mobile phone number, first select the role ](../roles/list-roles.md#选择角色) and determine the role to be assigned and the default role. Inviting via GitHub login is not currently supported. Role configuration cannot be omitted.
Prepare personal access token and target workspace ID with corresponding permissions for the target workspace.
Request body¶
curl -X POST "$CLOUDSIGMA_API_BASE/user/create" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H "Content-Type: application/json" \
-d '{
"name": "data_analyst",
"email": "analyst@example.com",
"role_id_list": [1001],
"default_role_id": 1001,
"tag_list": []
}'
Parameter |
Type |
Required |
Description |
|---|---|---|---|
name |
string |
Yes |
The user’s name in the current workspace, which can be up to 255 characters long. |
string |
Conditional |
Invitation email. Alternative to mobile_number. |
|
mobile_number |
string |
Conditional |
Mainland China 11 mobile phone number. Choose one from email. |
github_login |
string |
Not currently supported |
Inviting via GitHub login is not currently supported and this field has no effect. |
description |
string |
No |
User Instructions. |
default_role_id |
integer |
Conditional |
Default role ID. When providing a role list, it must belong to role_id_list. |
password |
string |
No |
This field is inactive and the account password will not be set. |
role_id_list |
integer (integer array) |
Conditional |
Initial list of role IDs. Email or mobile phone number cannot be empty when inviting. |
tag_list |
array of object |
No |
Initial user label. Each item contains an id and a value. |
tag_list[].id |
integer |
Yes |
Tag ID. |
tag_list[].value |
string |
Yes |
tag value. |
Only registered accounts can be invited. Please fill in your email address and mobile phone number. The role list cannot be empty, and the default role cannot be 0 and must belong to the list.
password will not set the invitee’s password, and GitHub contact information cannot be used for invitations. A successful request only means that the invitation has been sent, and the invitee still needs to accept the invitation.
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": "iam-user-001"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
success code. |
|
string |
Response information. |
|
object |
The data returned by this operation. |
|
string |
The IAM user ID of the invitation target. When the GitHub pending invitation has not been associated with an account, it will be an empty string. |
Error response¶
{
"code": "INVALID_ARGUMENT",
"msg": "请求参数无效",
"data": null
}
Field |
Type |
Description |
|---|---|---|
code |
string |
error code. |
msg |
string |
error message. |
data |
null |
—。 |
Common HTTP errors¶
HTTP status |
Error code |
Common cause |
Recommended action |
|---|---|---|---|
400 |
|
Invalid request field, workspace, or operation precondition. |
Fix the request parameters and submit again. |
401 |
|
Missing or invalid authentication credentials. |
Check the credential type, expiration, and authentication header. |
403 |
|
The current identity or active role does not have permission for this operation. |
Use an authorized identity or contact an administrator to grant access. |
404 |
|
The target object or required reference was not found. |
Verify the object identifier, workspace, and current status. |
409 |
|
Conflict in resource state, request payload, or concurrent modification. |
Re-read the current state and version, then handle according to the latest result. |
500 |
|
Internal processing failed; write operations may have been partially applied. |
Retain request and trace details, and verify the current state before retrying. |
503 |
|
A business, runtime, or authorization dependency is temporarily unavailable. |
After the dependency recovers, check existing results first instead of blindly repeating writes. |