Skip to main content
HTTP methods clearly express the intent of an API and help follow RESTful principles.

HTTP Methods Overview

GET

Data retrieval Safe and idempotent

POST

Data creation Non-idempotent

PUT

Data modification Idempotent

DELETE

Data deletion Idempotent

GET - Retrieval

Used to retrieve data. Does not modify server state.

Single Resource Retrieval

List Retrieval

GET Method Characteristics: - Safe: Does not modify server state - Idempotent: Same request multiple times yields same result - Cacheable: Can be cached by browser/proxy - Parameters are passed via URL query string

POST - Creation

Used to create new resources.

Simple Creation

Batch Creation

POST Method Characteristics: - Unsafe: Modifies server state - Non-idempotent: Same request multiple times may create duplicate resources - Not cacheable - Parameters are passed via Body - Typically returns the ID of the created resource

PUT - Modification

Used to modify existing resources.

Full Update

Partial Update (PATCH Style)

Status Change

PUT Method Characteristics: - Unsafe: Modifies server state - Idempotent: Same request multiple times yields same result - Typically replaces the entire resource - Parameters are passed via Body - Returns empty response or updated resource on success

DELETE - Deletion

Used to delete resources.

Single Deletion

Soft Delete

Batch Deletion

DELETE Method Characteristics: - Unsafe: Modifies server state - Idempotent: Deleting an already deleted resource yields same result - Generally returns empty response on success (204 No Content) - Consider soft delete (using deleted_at column)

Method Selection Guide

Selection Criteria

RESTful Principles

Good Examples

Bad Examples

Next Steps

Parameters

Type definitions and validation

Return Types

Defining response types

@api Decorator

Basic usage

Error Handling

API error handling