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.

To access the data, you don't always need to create it from scratch. Our REST API allows you to effortlessly fetch reserved mock data through a simple GET request. Additionally, you have the option to retrieve custom data that you've created yourself. You can either fetch a single object or request multiple objects in bulk by providing their respective object IDs as part of a single GET request. This way, you have full control and ease of access to the data you need for your application.

API Dog

List of all endpoints


  • GETList of all objects-

    Response

    200

    [ { "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" } } ]




  • GETList of objects by ids+

  • GETSingle object+

  • POSTAdd object+

  • PUTUpdate object+

  • PATCHPartially update object+

  • DELETEDelete object+

How to use it?


JavaScript  

Send a GET request in JavaScript

In case you want to request a particular object from an 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" }