Ana içeriğe geç

List Consumers

Endpoint​

GET /apiops/projects/{projectName}/consumers

Authentication​

Requires a Personal API Access Token.

Authorization: Bearer YOUR_TOKEN

Request​

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name

Query Parameters​

ParameterTypeRequiredDescription
organizationCodestringNoOnly the consumers of this organization. An unknown code answers 404 resourceNotFound
enabledOnlybooleanNotrue returns only enabled consumers
searchstringNoCase-insensitive contains-match on username and full name
pageintegerNoZero-based page index. Default 0
sizeintegerNoRows per page. Default 20, capped at 200
sortstringNofield,asc or field,desc. Fields: username, fullName, enabled. Default username,asc

Response​

200 OK with the paged envelope. Each item is a consumer:

FieldTypeDescription
consumerKeystringImmutable key of the consumer, assigned by the installation
usernamestringUsername of the consumer. Immutable
fullNamestringDisplay name
emailstringEmail address
descriptionstringDescription
enabledbooleanWhether the consumer is enabled
organizationCodestringCode of the organization of the consumer. Absent when the consumer belongs to none
expireDatetimestampExpiry of the consumer. Absent when the consumer does not expire
trafficLogDisabledbooleantrue when the traffic of the consumer is not written to the traffic-log connectors. Absent when never set
ipListarray of stringAllowed IP addresses, as PUT /consumers/{consumerKey} writes them
roleNamesarray of stringNames of the roles of the consumer. These are the names roleNameList accepts
metadataarrayMetadata entries. A secret entry carries its key and flags but no value

No password, secret or token setting is ever returned. Read the token settings with Get Consumer Token Settings and the secret material references with Get Consumer Secret References.

Warning

A secret metadata entry comes without its value. If you send the list back on Update Consumer, the server stores that entry empty. Send the value again to keep it.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/consumers?enabledOnly=true&sort=username,asc" \
-H "Authorization: Bearer YOUR_TOKEN"

Permissions​

  • User must have IDENTITY + VIEW permission in the project
  • A project outside the scope of the caller answers 404 resourceNotFound, never 403
  • The admin project has no consumers: a call on it answers 400 malformedRequest (params.reason = platformScopeNotSupported)