Ana içeriğe geç

Update Consumer Role

Endpoint​

PUT /apiops/projects/{projectName}/consumer-roles/{roleName}

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
roleNamestringYesName of the role in the project

Request Body​

{
"oauthScope": ""
}

Same fields as Create Consumer Role.

Value you sendResult
name or oauthScope omitted, or nullThe stored value stays
oauthScope empty ("")The OAuth scope is removed
name different from the stored nameThe role is renamed. Consumers and applications keep the role

Only a rename checks the name. A different name that another role of the project or of the admin project holds answers 409 duplicateName. An invalid or already used OAuth scope name answers 400 malformedRequest.

Response​

200 OK.

The response is a write response. result is the role. runtimeDeployment.state is IN_SYNC when every environment acknowledged the change, or DEGRADED when the change is stored but at least one environment did not acknowledge it. Do not retry a DEGRADED write; redeploy instead. resourceVersion is not returned.

An unknown roleName answers 404 resourceNotFound.

cURL Example​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/consumer-roles/API_USER" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{ "name": "API_READER" }'

Permissions​

  • User must have IDENTITY + MANAGE permission in the project
  • A project outside the scope of the caller answers 404 resourceNotFound, never 403
  • The admin project is served: a call on /apiops/projects/admin/consumer-roles addresses the roles of the admin project