API Playground
Test REST APIs directly in your browser. A lightweight Postman alternative.
Headers
What is API Testing?
API testing involves sending HTTP requests to web services to verify they work correctly. APIs (Application Programming Interfaces) are the backbone of modern web applications, allowing different systems to communicate.
Common HTTP Methods
- GET - Retrieve data from a server (read-only)
- POST - Send data to create new resources
- PUT - Update existing resources
- PATCH - Partially update existing resources
- DELETE - Remove resources
HTTP Status Codes
- 2xx (Success) - Request was successful (200 OK, 201 Created)
- 4xx (Client Error) - Problem with the request (400 Bad Request, 404 Not Found, 401 Unauthorized)
- 5xx (Server Error) - Server failed to fulfill a valid request (500 Internal Server Error, 503 Service Unavailable)
How to Use the API Playground
- Select HTTP Method: Choose GET, POST, PUT, DELETE, or PATCH from the dropdown
- Enter URL: Type the API endpoint you want to test (must include https:// or http://)
- Add Headers: Click "Add Header" to include custom headers like Authorization or Content-Type
- Add Body (if needed): For POST/PUT/PATCH requests, enter JSON data in the body editor
- Send Request: Click the "Send" button or press Enter in the URL field
- View Response: Check the status code, response time, size, and body data
Tip: Click "Load Example" to try the tool with a sample API request from JSONPlaceholder.
Common Use Cases
Frontend Development
Test backend APIs before integrating them into your application. Verify responses and error handling without writing code.
API Documentation
Quickly test public APIs while reading their documentation. Experiment with different parameters and see live results.
Debugging Issues
Isolate API problems by testing endpoints directly. Check if issues are in your code or the API itself.
Learning HTTP/REST
Understand how HTTP requests work by experimenting with different methods, headers, and payloads in real-time.
Understanding CORS Errors
CORS (Cross-Origin Resource Sharing) is a browser security feature that blocks web pages from making requests to different domains. If you see a "Network error" or "Failed to fetch" message, it's likely due to CORS restrictions.
Why Does This Happen?
Browsers prevent JavaScript from making cross-origin requests unless the server explicitly allows it with CORS headers. This protects users from malicious websites making unauthorized requests.
Solutions
- Use APIs with CORS enabled: Many public APIs (like JSONPlaceholder) allow cross-origin requests
- Test your own APIs: Configure your backend to include CORS headers (Access-Control-Allow-Origin)
- Use browser extensions: Install CORS unblock extensions for local testing (not recommended for production)
- Server-side testing: Use tools like Postman desktop app or curl for testing APIs without CORS restrictions
Note: This is a browser-side tool running client-side JavaScript. Native apps and server-side tools (like Postman desktop) don't have CORS restrictions.
Tips & Best Practices
๐ Start with Documentation
Always read the API documentation first. Note required headers, authentication methods, and expected request format.
๐ Handle Authentication
Add Authorization headers for protected endpoints. Use Bearer tokens, API keys, or Basic auth as required by the API.
โ Validate JSON
Always validate your JSON body before sending POST/PUT requests. Invalid JSON will result in 400 Bad Request errors.
โฑ๏ธ Check Response Times
Monitor response times to identify slow endpoints. Times over 1000ms might indicate performance issues.
๐ Read Error Messages
Pay attention to error responses. APIs often include helpful error messages explaining what went wrong.
๐งช Test Public APIs First
Practice with public test APIs like JSONPlaceholder, ReqRes, or HTTPBin before testing your own endpoints.