HTTP Methods (GET, POST, PUT, DELETE)

Part 2 — the verbs that define what an API call does.

By SixQuality · API Testing

HTTP methods (also called verbs) describe the action you want to perform on a resource. The four you will use most map neatly onto the classic create, read, update, delete operations.

MethodActionTypical use
GETReadRetrieve a resource; should not change data
POSTCreateCreate a new resource
PUTUpdate/replaceReplace an existing resource
PATCHPartial updateModify part of a resource
DELETEDeleteRemove a resource

Safe and idempotent

Two properties matter when testing. A safe method does not change data (GET). An idempotent method gives the same result no matter how many times you repeat it (GET, PUT, DELETE). POST is neither — calling it twice usually creates two resources.

Test idea: verify that GET never alters data, that DELETE twice behaves sensibly (second call returns not-found), and that PUT is truly idempotent. These properties are common sources of real bugs.

Conclusion

The HTTP methods define the intent of each call, and their safe/idempotent properties give you concrete behaviours to test. Knowing which verb does what is essential for designing correct, meaningful API tests.

← Previous: 1. HTTP Fundamentals for API Testing Next: 3. HTTP Status Codes Explained →