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
| Method | Purpose | Example Use Case |
|---|---|---|
| GET | Read data | Fetch a list of users or products |
| POST | Create data | Add a new item to a database |
| PUT | Update data | Replace an existing record |
| PATCH | Modify data | Update part of a record |
| DELETE | Remove data | Delete 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)
| Code | Meaning | Explanation |
|---|---|---|
| 200 | OK | Request completed successfully |
| 201 | Created | New resource was created |
| 204 | No Content | Success with no response body |
Success:
If you see a 2xx status code, your request worked as expected.
Client Errors (4xx)
| Code | Meaning | Explanation |
|---|---|---|
| 400 | Bad Request | Invalid request data |
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | Access denied |
| 404 | Not Found | Resource 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)
| Code | Meaning | Explanation |
|---|---|---|
| 500 | Server Error | Something broke on the server |
| 502 | Bad Gateway | Invalid response from server |
| 503 | Service Unavailable | Server 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.