Updated on 2025-12-29 GMT+08:00

Modifying User Parameters

Function

This API is used to modify parameters of a user (only for RabbitMQ AMQP).

Calling Method

For details, see Calling APIs.

URI

PUT /v2/{project_id}/instances/{instance_id}/users/{user_name}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

instance_id

Yes

String

Instance ID.

user_name

Yes

String

Username.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

access_key

Yes

String

Definition:

Username.

Range:

N/A

secret_key

Yes

String

Definition:

Key.

Range:

  • 8 to 32 characters

  • At least three types of the following characters:

    • Uppercase letters

    • Lowercase letters

    • Digits

    • Special characters `~!@#$%^&*()-_=+\|[{}];:'",<.>/?

  • Cannot be the username or the username spelled backwards.

vhosts

Yes

Array of AMQPUserPerm objects

Definition:

Virtual hosts to be granted permissions for. Each user can have permissions for multiple virtual hosts.

Table 3 AMQPUserPerm

Parameter

Mandatory

Type

Description

vhost

Yes

String

Definition:

Name of the virtual host to be granted permissions for. Each user can have permissions for multiple virtual hosts.

Range:

N/A

conf

Yes

String

Definition:

Granting resource permissions using regular expressions. For example, if you enter ^janeway-.* in the text box, it indicates that the user is authorized to configure all the resources whose names start with janeway- in this virtual host.

Range:

N/A

write

Yes

String

Definition:

Granting resource write permissions using regular expressions. For example, if you enter .* in the text box, it indicates that the user is authorized to write to all resources in this virtual host.

Range:

N/A

read

Yes

String

Definition:

Granting resource read permissions using regular expressions. For example, if you enter .* in the text box, it indicates that the user is authorized to read all resources in this virtual host.

Range:

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

access_key

String

Definition:

Username.

Range:

N/A

secret_key

String

Definition:

Key.

Range:

  • 8 to 32 characters

  • At least three types of the following characters:

    • Uppercase letters

    • Lowercase letters

    • Digits

    • Special characters `~!@#$%^&*()-_=+\|[{}];:'",<.>/?

  • Cannot be the username or the username spelled backwards.

vhosts

Array of AMQPUserPerm objects

Definition:

Virtual hosts to be granted permissions for. Each user can have permissions for multiple virtual hosts.

Table 5 AMQPUserPerm

Parameter

Type

Description

vhost

String

Definition:

Name of the virtual host to be granted permissions for. Each user can have permissions for multiple virtual hosts.

Range:

N/A

conf

String

Definition:

Granting resource permissions using regular expressions. For example, if you enter ^janeway-.* in the text box, it indicates that the user is authorized to configure all the resources whose names start with janeway- in this virtual host.

Range:

N/A

write

String

Definition:

Granting resource write permissions using regular expressions. For example, if you enter .* in the text box, it indicates that the user is authorized to write to all resources in this virtual host.

Range:

N/A

read

String

Definition:

Granting resource read permissions using regular expressions. For example, if you enter .* in the text box, it indicates that the user is authorized to read all resources in this virtual host.

Range:

N/A

Example Requests

Modifying parameters of the user to enable access to the virtual host default, grant read or write permissions to all resources under the virtual host, and allow configurations only on resources starting with janeway-

PUT https://{endpoint}/v2/{project_id}/instances/{instance_id}/users/{user_name}

{
  "access_key" : "admin123",
  "secret_key" : "**************",
  "vhosts" : [ {
    "vhost" : "default",
    "conf" : "^janeway-.*",
    "write" : ".*",
    "read" : ".*"
  } ]
}

Example Responses

Status code: 200

Successful

{
  "access_key" : "admin123",
  "secret_key" : "**************",
  "vhosts" : [ {
    "vhost" : "default",
    "conf" : "^janeway-.*",
    "write" : ".*",
    "read" : ".*"
  } ]
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.