API Methods & Status Codes

Learn how API methods work and how to understand HTTP status codes in DevSpace APIs.

API Methods

API methods (also called HTTP methods) define what action you want to perform on the server.

DevSpace APIs follow standard REST conventions, so once you understand these methods, you can apply the same knowledge anywhere.


Common API Methods

MethodPurposeExample Use Case
GETRead dataFetch a list of users or products
POSTCreate dataAdd a new item to a database
PUTUpdate dataReplace an existing record
PATCHModify dataUpdate part of a record
DELETERemove dataDelete a resource permanently

Learning Tip:

Most beginner projects use only GET and POST.
Focus on mastering these first before moving to PUT, PATCH, and DELETE.


When to Use Each Method

  • Use GET when you only need data
  • Use POST when sending new data to the server
  • Use PUT when replacing existing data
  • Use PATCH for small updates
  • Use DELETE when removing something permanently

Understanding this makes APIs predictable and easier to debug.


HTTP Status Codes

Status codes tell you what happened after making an API request.

They are grouped by category, which helps you quickly understand success or failure.


Success Responses (2xx)

CodeMeaningExplanation
200OKRequest completed successfully
201CreatedNew resource was created
204No ContentSuccess with no response body

Success:

If you see a 2xx status code, your request worked as expected.


Client Errors (4xx)

CodeMeaningExplanation
400Bad RequestInvalid request data
401UnauthorizedMissing or invalid API key
403ForbiddenAccess denied
404Not FoundResource does not exist

Important:

Most API errors during development are 400 or 401 errors.
Always check your request data and API key first.


Server Errors (5xx)

CodeMeaningExplanation
500Server ErrorSomething broke on the server
502Bad GatewayInvalid response from server
503Service UnavailableServer is temporarily down

Server Issue:

If you receive a 5xx error, the issue is usually not your fault.
Try again later or check the API status.


Why Status Codes Matter

Understanding status codes helps you:

  • Debug faster
  • Build better error handling
  • Write cleaner frontend logic
  • Understand real-world backend behavior

This skill is essential for both frontend and backend developers.


Summary

  • API methods define what action you’re taking
  • Status codes explain what happened
  • Learning both makes APIs easier to use and debug

Once you understand these basics, working with DevSpace APIs—and any real-world API—becomes much easier.