Free public REST API

Real REST API which is ready to handle your HTTP requests 24/7 for free. Can be used for your demo projects, testing, learning or even educating someone else. This REST API supports main HTTP methods such as GET, POST, PUT, DELETE and PATCH.

REST API


Welcome to our real REST API, where your data is securely stored in a real database, ensuring that your created data will be preserved and not lost. Our resource schema provides you with remarkable flexibility, allowing you to create custom objects with various attributes of different types. These attributes are stored as part of a "data" field, forming a customizable JSON object. This unique feature enables you to simulate a wide range of real-world application scenarios, from storing and retrieving prices, dates, and image URLs to simple text fields and beyond.

Our API consists of two parts: a public API, available to anyone without the need for an account, allowing you to quickly test and explore the service, and a private API, available to authenticated users who need greater flexibility and control. With the private API, you can create and organize your own collections, designing data structures that perfectly fit your application's needs.

API Dog

List of all endpoints


Show endpoints for:

  • Description

    Retrieves a predefined set of sample objects from the public API. This endpoint provides a limited, reserved selection available for demonstration purposes - not all stored objects created by you or others. However, if you want to access multiple objects that you’ve created, you can use query parameters to retrieve specific objects by their IDs. Alternatively, you can sign up and use the authenticated API to access objects from your own collections in a more convenient and confidential manner


    Parameters

    id (string[]) - Optional query parameter for specifying one or more object IDs. When provided, the response includes only the specified objects and excludes all others. Supports multiple values by repeating the parameter in the query string (e.g., ?id=3&id=5&id=10)


    Response body example
    [
      {
        "id": "1",
        "name": "Google Pixel 6 Pro",
        "data": {
          "color": "Cloudy White",
          "capacity": "128 GB"
        }
      },
      {
        "id": "2",
        "name": "Apple iPhone 12 Mini, 256GB, Blue",
        "data": null
      },
      {
        "id": "3",
        "name": "Apple iPhone 12 Pro Max",
        "data": {
          "color": "Cloudy White",
          "capacity GB": 512
        }
      },
      {
        "id": "4",
        "name": "Apple iPhone 11, 64GB",
        "data": {
          "price": 389.99,
          "color": "Purple"
        }
      },
      {
        "id": "5",
        "name": "Samsung Galaxy Z Fold2",
        "data": {
          "price": 689.99,
          "color": "Brown"
        }
      },
      {
        "id": "6",
        "name": "Apple AirPods",
        "data": {
          "generation": "3rd",
          "price": 120
        }
      },
      {
        "id": "7",
        "name": "Apple MacBook Pro 16",
        "data": {
          "year": 2019,
          "price": 1849.99,
          "CPU model": "Intel Core i9",
          "Hard disk size": "1 TB"
        }
      },
      {
        "id": "8",
        "name": "Apple Watch Series 8",
        "data": {
          "Strap Colour": "Elderberry",
          "Case Size": "41mm"
        }
      },
      {
        "id": "9",
        "name": "Beats Studio3 Wireless",
        "data": {
          "Color": "Red",
          "Description": "High-performance wireless noise cancelling headphones"
        }
      },
      {
        "id": "10",
        "name": "Apple iPad Mini 5th Gen",
        "data": {
          "Capacity": "64 GB",
          "Screen size": 7.9
        }
      },
      {
        "id": "11",
        "name": "Apple iPad Mini 5th Gen",
        "data": {
          "Capacity": "254 GB",
          "Screen size": 7.9
        }
      },
      {
        "id": "12",
        "name": "Apple iPad Air",
        "data": {
          "Generation": "4th",
          "Price": "419.99",
          "Capacity": "64 GB"
        }
      },
      {
        "id": "13",
        "name": "Apple iPad Air",
        "data": {
          "Generation": "4th",
          "Price": "519.99",
          "Capacity": "256 GB"
        }
      }
    ]
  • Description

    Retrieves detailed information for a single object specified by its unique ID.


    Parameters

    id (string) (required) - The unique ID of the object to fetch from the collection.


    Request url example

    https://api.restful-api.dev/objects/7


    Response body example
    {
      "id": "7",
      "name": "Apple MacBook Pro 16",
      "data": {
        "year": 2019,
        "price": 1849.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB"
      }
    }
  • Description

    Creates and stores a new object using the data provided in the request body.


    Request body example
    {
      "name": "Apple MacBook Pro 16",
      "data": {
        "year": 2019,
        "price": 1849.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB"
      }
    }

    Response body example
    {
      "id": "7",
      "name": "Apple MacBook Pro 16",
      "data": {
        "year": 2019,
        "price": 1849.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB"
      },
      "createdAt": "2022-11-21T20:06:23.986Z"
    }
  • Description

    Completely replaces the data of an existing object identified by its ID with new information.


    Parameters

    id (string) (required) - The ID of the object to update entirely with new data.


    Request url example

    https://api.restful-api.dev/objects/7


    Request body example
    {
      "name": "Apple MacBook Pro 16",
      "data": {
        "year": 2019,
        "price": 2049.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB",
        "color": "silver"
      }
    }

    Response body example
    {
      "id": "7",
      "name": "Apple MacBook Pro 16",
      "data": {
        "year": 2019,
        "price": 2049.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB",
        "color": "silver"
      },
      "updatedAt": "2022-12-25T21:08:41.986Z"
    }
  • Description

    Applies partial modifications to an object by updating only specific fields provided in the request body.


    Parameters

    id (string) (required) - The ID of the object to modify. Only specified fields will be updated.


    Request url example

    https://api.restful-api.dev/objects/7


    Request body example
    {
      "name": "Apple MacBook Pro 16 (Updated Name)"
    }

    Response body example
    {
      "id": "7",
      "name": "Apple MacBook Pro 16 (Updated Name)",
      "data": {
        "year": 2019,
        "price": 1849.99,
        "CPU model": "Intel Core i9",
        "Hard disk size": "1 TB"
      },
      "updatedAt": "2022-12-25T21:09:46.986Z"
    }
  • Description

    Removes an object permanently by specifying its unique ID.


    Parameters

    id (string) (required) - The unique ID of the object to remove from the collection.


    Request url example

    https://api.restful-api.dev/objects/6


    Response body example
    {
      "message": "Object with id = 6, has been deleted."
    }

How to use it?


JavaScript  

Send a GET request in JavaScript

In case you want to request a particular object from our public API and this object already exists and you know an object ID of it, you can simply send a GET request to fetch it.

var xhr = new XMLHttpRequest();
var requestUrl = "https://api.restful-api.dev/objects/4";
xhr.open("GET", requestUrl, true); 
xhr.onload = function(){
    console.log(xhr.responseText);
    // Handle data
};
xhr.send();

In the example above we are fetching the object with id = 4. Response from an API would look like this:

{
  "id": 4,
  "name": "Apple iPhone 11, 64GB",
  "data": {
     "price": 389.99,
     "color": "Purple"
  }
}

In order to fetch another object, you can always change the object ID which comes as part of your GET request URL. For example, changing the object id from 4 to 5 will return you the following response:

{
  "id": 5,
  "name": "Samsung Galaxy Z Fold2",
  "data": {
     "price": 689.99,
     "color": "Brown"
  }
}

Java  

Send a POST request in Java

In case you want to add a new object using POST:

String body = "{\"name\": \"Apple iPad Air\", \"data\": { \"Generation\": \"4th\", \"Price\": \"519.99\", \"Capacity\": \"256 GB\" }}";
URL url = new URL("https://api.restful-api.dev/objects");
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
conn.setRequestMethod("POST");
conn.setDoOutput(true);
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("User-Agent", "Mozilla/5.0");

try (DataOutputStream dos = new DataOutputStream(conn.getOutputStream())) {
    dos.writeBytes(body);
}

try (BufferedReader bf = new BufferedReader(new InputStreamReader(conn.getInputStream()))) {
    String line;
    while ((line = bf.readLine()) != null) {
        System.out.println(line);
    }
}

Data from this request would get stored in the database and API would reply to you with a response that would look like this:

{
    "id": 13,
    "name": "Apple iPad Air",
    "data": {
       "Generation": "4th",
       "Price": "519.99",
       "Capacity": "256 GB"
    },
    "createdAt": "2022-11-21T20:06:23.986Z"
}

Keep in mind that every time you execute this piece of code, you will create a new object with the same data but a new object id. To store unique objects, update the body of your request.

After executing a POST request, you can access the created object via GET request by providing the corresponding object id as part of a GET request url.

Python  

Send a PUT request in Python

In case you want to update the price attribute of an existing object below from 120 to 135 and to add an extra color attribute using PUT:

{
  "id": 6,
  "name": "Apple AirPods",
  "data": {
     "generation": "3rd",
     "price": 120
  }
}

Pass a complete representation of the updated object as part of a body and the object id as part of a request url.

import requests
import json

headers = {"content-type": "application/json"}
payload = json.dumps({ "name": "Apple AirPods", "data": { "color": "white", "generation": "3rd", "price": 135}})
requestUrl = "https://api.restful-api.dev/objects/6"
r = requests.put(requestUrl, data=payload, headers=headers)

print(r.content)

Response would look like this:

{
  "id": 6,
  "name": "Apple AirPods",
  "data": {
     "color": "white",
     "generation": "3rd",
     "price": 135
  }
  "updatedAt": "2022-11-21T20:06:23.986Z"
}