Simple GET API Call (Hello World & Ping)
The simplest example of an API: sending an HTTP GET request to check server status and receiving a JSON response.
What is an API example? Test 30+ real HTTP & REST API request and response examples (GET, POST, PUT, DELETE, Bearer Auth, Weather, Webhooks, Status Codes) with copy-paste JSON, cURL, Fetch & Python code.
An API call sends an HTTP Request (Method, URL, Headers, Body) from a client to a server and receives an HTTP Response (Status Code 200 OK + JSON Body).
The simplest example of an API: sending an HTTP GET request to check server status and receiving a JSON response.
Standard REST API pattern requesting a specific record using a URL path parameter ID.
Submitting a JSON payload to a server to create a new database record and receiving 201 Created.
Filtering, sorting, and limiting collection records using URL query strings (?category=laptops&sort=price_asc).
Testing API mechanics: send any JSON object and the server mirrors it back with parsed IP, headers, and payload verification.
Sending an HTTP DELETE request to remove a specific item and receiving 200 OK or 204 No Content.
Completely replacing all attributes of an existing resource using idempotent PUT.
Modifying a single property without sending the entire resource object.
Inserting multiple records in a single transactional HTTP request to minimize network overhead.
Querying sub-resources hierarchically scoped under a parent entity.
Restoring a soft-deleted item from the trash using a state-transition action endpoint.
Upsert pattern: creates the preference if missing, or updates it if already existing.
Authorizing secure requests using the Authorization: Bearer <JWT> HTTP header.
Server-to-server and B2B authentication using an X-API-Key header.
Exchanging an authorization code for an access token and refresh token.
Requesting a fresh short-lived access token using a long-lived refresh token.
Classic HTTP Basic Authentication using base64 encoded username:password headers.
Querying real live weather conditions and temperature forecasts by latitude and longitude.
Fetching live foreign exchange rates and conversion ratios against a base currency.
Querying open-source repository metadata, stars, forks, and license details from GitHub.
Clean read-only public API querying gaming sprites, stats, and abilities.
Lightweight media URL provider returning random image assets with clean status indicators.
Querying official calendar holidays by country code and year.
High-performance infinite scroll pagination using opaque cursor tokens instead of slow SQL offset.
Receiving asynchronous server notifications and verifying authenticity via HMAC SHA-256 signatures.
Inspecting X-RateLimit-Limit, Remaining, and Reset headers, and handling 429 responses.
Executing a GraphQL query over standard HTTP POST with query string and variables.
Uploading binary files and images using multipart/form-data with metadata boundaries.
Handling malformed request bodies and client-side syntax errors.
Response when requests lack required authentication credentials or tokens.
Standard response when a requested resource does not exist in the database.
Detailed field-by-field validation errors (e.g. weak password, invalid email format).