IPA-105: List
In many APIs, it is customary to make a GET request to a collection's URI (for
example, /groups/{groupId}/clusters) to retrieve a list of resources, each of
which lives within that collection.
Guidance
APIs must provide a List method for resources unless the resource is a singleton.
- The purpose of the List method is to return data from a finite collection
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:The collection
/groups/{groupId}/clustersexposes aGETList method, so callers can retrieve the finite set of clusters within the group.For each collection URI in
paths(a path ending in a collection noun with no trailing resource identifier), check whether the resource is a singleton. Singletons are exempt.Confirm the collection URI defines a
getoperation.If a non-singleton collection has no
getoperation, flag the missing List method.
The HTTP verb must be
GET.paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:The List method is defined under the
getverb on the collection URI.The method must not cause side effects.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClusters
responses:
"200":
description: OKWhy:The List operation only reads and returns the collection; it does not create, modify, or delete any resource.
Inspect the
getoperation on the collection URI and review its description and behavior.Confirm the operation only reads data and does not mutate server state.
If the operation creates, updates, or deletes resources, flag it as causing side effects.
The request must not include a body.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClusters
parameters:
- name: groupId
in: path
required: true
schema:
type: stringWhy:The List operation defines no
requestBody; all input is supplied through path and query parameters.The response body should consist of the same resource object returned by the Get method.
- The object may include any
HATEOAS
linksfield from the individual resource
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClusters
responses:
"200":
content:
application/json:
schema:
type: object
properties:
results:
type: array
items:
$ref: "#/components/schemas/ClusterResponse"
/groups/{groupId}/clusters/{clusterName}:
get:
operationId: getGroupCluster
responses:
"200":
content:
application/json:
schema:
$ref: "#/components/schemas/ClusterResponse"Why:The List response reuses the same
ClusterResponseobject returned by the Get method, so a single resource has one consistent shape across both methods.Locate the resource schema returned by the Get method for the same resource.
Compare it to the object type returned in the List method's response array.
If the List method returns a different object shape, flag the divergence.
- The object may include any
HATEOAS
The response status code must be 200 OK.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClusters
responses:
"200":
description: OKWhy:The successful List response is declared with the
200status code.
Example
GET /groups/${groupId}/clusters
Naming
Operation ID must be unique.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClusters
/groups/{groupId}/users:
get:
operationId: listGroupUsersWhy:Each operation has a distinct
operationId, so no two operations collide.Operation ID must be in
camelCase.paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:listGroupClustersstarts with a lowercase letter and capitalizes each subsequent word, followingcamelCase.Operation ID must start with the verb "list".
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:The
operationIdbegins with the verblist, identifying the operation as a List method.Operation ID should be followed by a noun or compound noun.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:The verb
listis followed by the compound nounGroupClusters, naming what is listed.The noun(s) in the Operation ID should be the collection identifiers from the resource identifier in singular form, where the last noun is in plural form.
paths:
/groups/{groupId}/clusters:
get:
operationId: listGroupClustersWhy:For
/groups/{groupId}/clusters, the collection identifiers aregroupsandclusters; the leading noun is singularized toGroupand the final noun stays plural asClusters, givinglistGroupClusters.Extract the collection identifiers from the resource URI in order, ignoring path parameters.
Singularize each collection identifier except the last, which stays plural, and concatenate them in
camelCaseafter thelistverb.Compare the result to the actual
operationId; if they differ, flag the naming mismatch.
Examples:
| Resource Identifier | Operation ID |
|---|---|
/groups/${groupId}/clusters | listGroupClusters |