Posted on

HTTP Methods Explained: GET, POST, PATCH and DELETE

Monochrome technical illustration for HTTP Methods Explained

HTTP methods are verbs that tell an API what operation you want: GET reads, POST creates, PATCH changes part of a resource, and DELETE removes it.

The URL identifies the resource, the method identifies the operation, headers carry context such as credentials, and a JSON body carries data for most writes.

The decision table

MethodUse it toTypical result
GETRead a collection or record200 OK
POSTCreate a record201 Created
PATCHUpdate selected fields200 OK
DELETERemove a record204 No Content

GET reads without changing data

Use GET for a collection or a single record. It should be safe to repeat. A private consumer request needs an app API key:

curl -i "https://meowmeowscratch.com/api/v1/YOUR_USERNAME/weather-station/readings/" \
  -H "Authorization: Bearer $MEOW_APP_API_KEY"Code language: JavaScript (javascript)

POST creates a new record

POST sends a JSON body to the collection route. Each successful call creates a new record, so do not blindly retry an uncertain POST unless the API or your client provides an idempotency strategy.

curl -i -X POST \
  "https://meowmeowscratch.com/api/apps/weather-station/endpoints/readings/records/" \
  -H "Authorization: Bearer $MEOW_APP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":{"temperature":22.5}}'Code language: JavaScript (javascript)

PATCH updates part of a record

PATCH targets one record UUID and changes the fields supplied in the body. Copy the UUID from the create or list response; never guess it.

curl -i -X PATCH \
  "https://meowmeowscratch.com/api/apps/weather-station/endpoints/readings/records/RECORD_UUID/" \
  -H "Authorization: Bearer $MEOW_APP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"data":{"temperature":23.0}}'Code language: JavaScript (javascript)

DELETE is destructive

DELETE removes the selected record. Confirm the URL and UUID before running it, and expect 204 No Content with no JSON body when the deletion succeeds.

curl -i -X DELETE \
  "https://meowmeowscratch.com/api/apps/weather-station/endpoints/readings/records/RECORD_UUID/" \
  -H "Authorization: Bearer $MEOW_APP_API_KEY"Code language: JavaScript (javascript)

Method, URL and body work together

  • Changing GET to POST does not turn a read URL into a valid create route automatically.
  • A collection URL and a record URL represent different resources.
  • Write bodies must match the endpoint schema and use valid JSON.
  • Credentials answer who may act; the method answers what they intend to do.
  • Keep the documented trailing slash on management routes to avoid redirects during writes.

Next step

Use HTTP Status Codes Explained to interpret the response from each method, or practice the complete sequence in the Python SDK guide.