Learn

Navigate through learn topics

Real-World Examples of Public API Endpoints

Explore public APIs that can be accessed without authentication, perfect for learning and testing API concepts

Last updated: 8/18/2025

Real-World Examples of Public API Endpoints

Public APIs provide an excellent way to learn about API concepts without the complexity of authentication and authorisation. These endpoints can be accessed directly in your browser, through command line tools, or in your applications without requiring API keys or login credentials.

What Are Public APIs?

Public APIs are endpoints that are freely accessible to anyone on the internet. They typically provide:

  • No Authentication Required: Access without API keys or login credentials
  • Rate Limiting: Usage restrictions to prevent abuse
  • Public Documentation: Open access to API specifications and examples
  • Educational Value: Perfect for learning API concepts and testing tools

JSONPlaceholder - Fake Test API

JSONPlaceholder is a popular public demo API designed specifically for testing and learning purposes.

Basic Endpoints

Posts API

GET https://jsonplaceholder.typicode.com/posts/1

Response Example

{
  "userId": 1,
  "id": 1,
  "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit",
  "body": "quia et suscipit suscipit recusandae consequuntur expedita et cum reprehenderit molestiae ut ut quas totam nostrum rerum est autem sunt rem eveniet architecto"
}

Available Resources

  • Posts: /posts - Blog post data
  • Comments: /comments - Comment data
  • Albums: /albums - Photo album data
  • Photos: /photos - Photo data
  • Todos: /todos - Task list data
  • Users: /users - User profile data

Testing Different HTTP Methods

GET Request (Retrieve Data)

curl https://jsonplaceholder.typicode.com/posts/1

POST Request (Create Data)

curl -X POST https://jsonplaceholder.typicode.com/posts \
  -H "Content-Type: application/json" \
  -d '{"title": "New Post", "body": "Post content", "userId": 1}'

PUT Request (Update Data)

curl -X PUT https://jsonplaceholder.typicode.com/posts/1 \
  -H "Content-Type: application/json" \
  -d '{"id": 1, "title": "Updated Post", "body": "Updated content", "userId": 1}'

DELETE Request (Remove Data)

curl -X DELETE https://jsonplaceholder.typicode.com/posts/1

Public Data APIs

Government and Public Information

OpenWeatherMap Current Weather

GET https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY

Note: While OpenWeatherMap requires a free API key, it's very easy to obtain and demonstrates basic authentication concepts.

Public Weather Alternative

GET https://wttr.in/London?format=j1

Response Example

{
  "current_condition": [
    {
      "temp_C": "18",
      "temp_F": "64",
      "weatherDesc": [
        {
          "value": "Partly cloudy"
        }
      ]
    }
  ]
}

Public Information Services

IP Geolocation

GET https://ipapi.co/json

Response Example

{
  "ip": "203.0.113.1",
  "city": "Sydney",
  "region": "New South Wales",
  "country": "AU",
  "postal": "2000",
  "latitude": -33.8688,
  "longitude": 151.2093,
  "timezone": "Australia/Sydney"
}

Public IP Address

GET https://api.ipify.org?format=json

Response Example

{
  "ip": "203.0.113.1"
}

Social Media Public APIs

GitHub Public Data

Public User Profile

GET https://api.github.com/users/octocat

Response Example

{
  "login": "octocat",
  "id": 583231,
  "node_id": "MDQ6VXNlcjU4MzIzMQ==",
  "avatar_url": "https://avatars.githubusercontent.com/u/583231?v=4",
  "gravatar_id": "",
  "url": "https://api.github.com/users/octocat",
  "html_url": "https://github.com/octocat",
  "followers_url": "https://api.github.com/users/octocat/followers",
  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
  "organizations_url": "https://api.github.com/users/octocat/orgs",
  "repos_url": "https://api.github.com/users/octocat/repos",
  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
  "received_events_url": "https://api.github.com/users/octocat/received_events",
  "type": "User",
  "site_admin": false,
  "name": "The Octocat",
  "company": "@github",
  "blog": "https://github.blog",
  "location": "San Francisco",
  "email": null,
  "hireable": null,
  "bio": null,
  "twitter_username": null,
  "public_repos": 8,
  "public_gists": 8,
  "followers": 3933,
  "following": 11,
  "created_at": "2011-01-25T18:44:36Z",
  "updated_at": "2024-01-15T10:30:00Z"
}

Public Repository Information

GET https://api.github.com/repos/octocat/Hello-World

Public Issues

GET https://api.github.com/repos/octocat/Hello-World/issues

Financial and Economic Data

Public Financial APIs

Exchange Rates (Free Tier)

GET https://api.exchangerate-api.com/v4/latest/USD

Response Example

{
  "result": "success",
  "base_code": "USD",
  "target_code": "AUD",
  "conversion_rate": 1.52,
  "conversion_result": 152.00
}

Cryptocurrency Prices

GET https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd,aud

Response Example

{
  "bitcoin": {
    "usd": 45000,
    "aud": 67500
  }
}

Entertainment and Media APIs

Public Entertainment Data

Movie Database (Public Data)

GET https://api.themoviedb.org/3/movie/550?api_key=YOUR_API_KEY

Note: TMDb requires a free API key but provides extensive movie and TV show data.

Public Alternative - Random User Generator

GET https://randomuser.me/api/

Response Example

{
  "results": [
    {
      "gender": "female",
      "name": {
        "title": "Ms",
        "first": "Olivia",
        "last": "Wilson"
      },
      "location": {
        "street": {
          "number": 1234,
          "name": "Main Street"
        },
        "city": "Sydney",
        "state": "New South Wales",
        "country": "Australia",
        "postcode": 2000
      },
      "email": "olivia.wilson@example.com",
      "login": {
        "uuid": "123e4567-e89b-12d3-a456-426614174000",
        "username": "happywolf123"
      },
      "picture": {
        "large": "https://randomuser.me/api/portraits/women/1.jpg",
        "medium": "https://randomuser.me/api/portraits/med/women/1.jpg",
        "thumbnail": "https://randomuser.me/api/portraits/thumb/women/1.jpg"
      }
    }
  ]
}

Testing and Development APIs

Mock and Test Services

HTTP Status Codes

GET https://httpstat.us/200
GET https://httpstat.us/404
GET https://httpstat.us/500

Response Headers

GET https://httpbin.org/headers

Response Example

{
  "headers": {
    "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
    "Accept-Encoding": "gzip, deflate",
    "Accept-Language": "en-US,en;q=0.5",
    "Host": "httpbin.org",
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Firefox/91.0"
  }
}

Delay Simulation

GET https://httpbin.org/delay/3

Response: Returns after 3 seconds, useful for testing timeout handling.

How to Test These APIs

Browser Testing

The simplest way to test public APIs is directly in your web browser:

  1. Copy the URL from any of the examples above
  2. Paste it into your browser's address bar
  3. Press Enter to see the response
  4. Observe the data structure and format

Command Line Testing

Use curl to test APIs from the terminal:

# Test JSONPlaceholder posts API
curl https://jsonplaceholder.typicode.com/posts/1

# Test IP geolocation
curl https://ipapi.co/json

# Test GitHub user API
curl https://api.github.com/users/octocat

JavaScript Testing

Test APIs directly in your browser's developer console:

// Test JSONPlaceholder API
fetch('https://jsonplaceholder.typicode.com/posts/1')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(error => console.error('Error:', error));

// Test IP geolocation
fetch('https://ipapi.co/json')
  .then(response => response.json())
  .then(data => console.log('Your location:', data.city, data.country))
  .catch(error => console.error('Error:', error));

Understanding the Responses

Common Response Patterns

Success Responses

  • 200 OK: Request succeeded, data returned
  • 201 Created: New resource created successfully
  • 204 No Content: Request succeeded, no data returned

Error Responses

  • 400 Bad Request: Invalid request format
  • 404 Not Found: Resource doesn't exist
  • 429 Too Many Requests: Rate limit exceeded
  • 500 Internal Server Error: Server encountered an error

Response Structure Analysis

Data Format

  • JSON: Most common format for modern APIs
  • XML: Legacy format, still used by some services
  • Plain Text: Simple responses for basic information

Response Headers

  • Content-Type: Specifies the response format
  • Cache-Control: Indicates caching instructions
  • Rate-Limit: Shows current usage and limits

Best Practices for Testing

Rate Limiting Awareness

Respect Limits

  • Most public APIs have rate limits
  • Don't make excessive requests
  • Use appropriate delays between requests
  • Monitor your usage to avoid being blocked

Testing Strategies

  • Development: Use mock APIs like JSONPlaceholder
  • Production Testing: Use staging environments when available
  • Load Testing: Use dedicated testing services

Error Handling

Common Scenarios

  • Network Errors: Connection failures and timeouts
  • API Errors: Invalid requests and server errors
  • Rate Limiting: Exceeded usage limits
  • Service Unavailable: API maintenance or downtime

Testing Error Conditions

  • Invalid URLs: Test with malformed endpoints
  • Missing Parameters: Test required parameter validation
  • Invalid Data: Test with incorrect data formats
  • Timeout Scenarios: Test with slow responses

Learning Opportunities

What You Can Learn

API Concepts

  • Request/Response Cycle: How data flows between client and server
  • HTTP Methods: Different ways to interact with resources
  • Status Codes: Understanding success and error responses
  • Data Formats: JSON structure and parsing

Practical Skills

  • API Testing: Using tools like curl, Postman and browsers
  • Data Handling: Processing and displaying API responses
  • Error Management: Handling various error conditions
  • Performance: Understanding response times and caching

Next Steps

Advanced Topics

  • Authentication: Working with APIs that require keys
  • Rate Limiting: Implementing proper request throttling
  • Caching: Storing responses to improve performance
  • Webhooks: Receiving real-time updates from APIs

Real Projects

  • Weather App: Build an application using weather APIs
  • Portfolio Tracker: Create a tool using financial APIs
  • Social Media Dashboard: Integrate with social media APIs
  • Location Services: Build apps using geolocation APIs

Conclusion

Public APIs provide an excellent foundation for learning API concepts without the complexity of authentication and security. By testing these endpoints, you can gain practical experience with:

  • Request Formation: Creating proper API requests
  • Response Processing: Handling different data formats
  • Error Handling: Managing various error conditions
  • Tool Usage: Testing with different client tools

Start with simple endpoints like JSONPlaceholder to understand basic concepts, then move to more complex APIs like GitHub to see real-world data structures. Remember to respect rate limits and use these APIs responsibly for learning and development purposes.

The skills you develop testing public APIs will serve you well when working with authenticated APIs in production environments. Use these examples as a starting point for your API learning journey.