Skip to content

Standard Methods (AIP-130)

Fresh -- Updated March 2026 from official Google Cloud API Design Guide.

Overview

Standard methods are the five fundamental CRUD operations that every resource-oriented API should support. They provide a consistent, predictable interface across all Google Cloud APIs.

The Five Standard Methods

MethodHTTP MappingRequest BodyResponse Body
GetGET /v1/{name=resources/*}NoneResource
ListGET /v1/{parent=parents/*}/resourcesNoneResource list
CreatePOST /v1/{parent=parents/*}/resourcesResourceResource
UpdatePATCH /v1/{name=resources/*}ResourceResource
DeleteDELETE /v1/{name=resources/*}NoneEmpty or Resource

Get

Retrieves a single resource by name.

bash
# Get a specific Pub/Sub topic
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://pubsub.googleapis.com/v1/projects/my-project/topics/my-topic"

Key behaviors:

  • Returns the full resource representation
  • Returns NOT_FOUND (404) if the resource does not exist
  • Must be idempotent (same request always returns the same result, barring updates)

List

Retrieves a collection of resources, with pagination support.

bash
# List all topics in a project (paginated)
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://pubsub.googleapis.com/v1/projects/my-project/topics?pageSize=10"

Pagination parameters:

ParameterTypeDescription
page_sizeint32Max results per page (server may return fewer)
page_tokenstringToken from previous response's next_page_token

Pagination response:

json
{
  "topics": [ ... ],
  "nextPageToken": "abc123"
}

When nextPageToken is empty, there are no more results.

Additional features:

  • Filtering: ?filter=labels.env=prod
  • Ordering: ?orderBy=createTime desc

Create

Creates a new resource in a collection.

bash
# Create a Pub/Sub topic
curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  "https://pubsub.googleapis.com/v1/projects/my-project/topics/my-new-topic"

Key behaviors:

  • The parent resource name is in the URL
  • Server assigns a resource ID unless the client provides one
  • Returns ALREADY_EXISTS (409) if a resource with that ID already exists
  • The response includes the created resource with server-generated fields (name, create_time)

Update

Modifies an existing resource. Uses PATCH for partial updates.

bash
# Update a topic's labels
curl -X PATCH \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -d '{"labels": {"env": "staging"}}' \
  "https://pubsub.googleapis.com/v1/projects/my-project/topics/my-topic?updateMask=labels"

Field masks (updateMask):

  • Specify which fields to update
  • Only listed fields are modified; others remain unchanged
  • Omitting the mask updates all fields (full replace)
MaskEffect
updateMask=labelsOnly update labels
updateMask=labels,displayNameUpdate labels and displayName
(no mask)Replace entire resource

Delete

Removes a resource.

bash
# Delete a topic
curl -X DELETE \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "https://pubsub.googleapis.com/v1/projects/my-project/topics/my-topic"

Key behaviors:

  • Idempotent: deleting an already-deleted resource may return NOT_FOUND or succeed silently
  • May support soft delete: sets delete_time instead of permanent removal
  • Soft-deleted resources can be recovered with an Undelete custom method

Standard Methods Flow

Idempotency

MethodSafeIdempotent
GetYesYes
ListYesYes
CreateNoNo (use request_id for dedup)
UpdateNoYes (same patch = same result)
DeleteNoYes

TIP

For Create, include a request_id field to make the operation idempotent. If the same request_id is sent twice, the server returns the existing resource instead of creating a duplicate.

See Also