Create Or Update Consumer
PUT {{gateway}}/consumers/:consumerUsernameOrId
Create Or Update Consumer konghq
- Inserts (or replaces) the Consumer under the requested resource with the definition specified in the body. The Consumer will be identified via the username or id attribute.
- When the username or id attribute has the structure of a UUID, the Consumer being inserted/replaced will be identified by its id. Otherwise it will be identified by its username.
- When creating a new Consumer without specifying id (neither in the URL nor in the body), then it will be auto-generated.
- Notice that specifying a username in the URL and a different one in the request body is not allowed.
Attributes | Mandatory | Type | Description |
---|
consumer username or id | required | path | The unique identifier or the username of the Consumer to retrieve. |
Request Body
Attributes | Mandatory | Description |
---|
username | semi-optional | The unique username of the consumer. You must send either this field or custom_id with the request. |
custom_id | semi-optional | Field for storing an existing unique ID for the consumer - useful for mapping Kong with users in your existing database. You must send either this field or username with the request. |
tags | optional | An optional set of strings associated with the Consumer, for grouping and filtering. |
Request Body
{"username"=>"my-username1", "custom_id"=>"my-custom-id1", "tags"=>["user-level", "low-priority"]}
Key | Datatype | Required | Description |
---|
Content-Type | string | | |
RESPONSES
status: OK
{"custom_id":"my-custom-id1","created_at":1583995052,"id":"c883d8e7-0a33-4153-9d18-0741a3412125","tags":["user-level","low-priority"],"username":"my-username1"}