Ana içeriğe geç

Delete Consumer Role

Endpoint​

DELETE /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

Query Parameters​

ParameterTypeRequiredDescription
forcebooleanNoDefault false. With true, a role that is still in use is deleted and removed from every holder. Without it, a role in use is not deleted

Response​

200 OK.

A role that nothing holds is deleted without force.

If consumers, applications or API proxy authorization settings (proxy level or method level) still hold the role, the call answers 409 dependencyConflict and nothing changes. params.reason is roleInUse; params.consumerCount, params.applicationCount and params.apiProxyCount give the number of holders.

{
"status": "FAILURE",
"errorKey": "dependencyConflict",
"message": "error.dependencyConflict",
"params": {
"reason": "roleInUse",
"consumerCount": 3,
"applicationCount": 1,
"apiProxyCount": 2,
"project": "MyProject",
"role": "API_USER"
},
"correlationId": "7f1c9e2a-8f43-4d2e-9a11-6b5d0c3e2f77"
}

With ?force=true, the delete removes the role from the consumers and applications that hold it, and from the authorization settings of the API proxies of the project. Then it undeploys the role. This is the same behavior as the Consumer Roles screen. The cascade runs only with force=true.

The response is a write response. result is the deleted 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 DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/consumer-roles/API_USER" \
-H "Authorization: Bearer YOUR_TOKEN"

Delete a role that is still in use and remove it from its holders:

curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/consumer-roles/API_USER?force=true" \
-H "Authorization: Bearer YOUR_TOKEN"

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