Support Dummy API's Mission
Your contribution will help me to keep Dummy API Ad-Free and also help with
the development of new and faster endpoints. You can choose to support me
via Stripe, PayPal , or
become a member of my Patreon .
Help Dummy API to stay Ad-Free 💕
A donation as little as 1$ helps! Support DummyAPI Payments powered by
This quickstart guide will provide a simple introduction to using DummyAPI. Below, you’ll find a selection of example endpoints to help you start integrating data into your applications.
Fetch all movies
fetch ( ' https://dummyapi.online/api/movies ' )
. then ( ( response ) => response . json ())
. then ( ( json ) => console . log ( json ));
import requests
import json
response = requests. get ( ' https://dummyapi.online/api/movies ' )
if response.status_code == 200 :
data = json. loads ( response.text )
print ( data )
Output [
{
id : 1 ,
movie : 'The Shawshank Redemption' ,
rating : 9.2 ,
image : 'images/shawshank.jpg' ,
imdb_url : 'https: //www.imdb.com/title/tt0111161/'
},
{
id : 2 ,
movie : 'The Godfather' ,
rating : 9.2 ,
image : 'images/godfather.jpg' ,
imdb_url : 'https: //www.imdb.com/title/tt0068646/'
},
...
]
Fetch a single movie
Getting a single entry of a certain resource. In this example, we use the /api/movies/1
route.
fetch ( ' https://dummyapi.online/api/movies/1 ' )
. then ( ( response ) => response . json ())
. then ( ( json ) => console . log ( json ));
import requests
import json
response = requests. get ( ' https://dummyapi.online/api/movies/1 ' )
if response.status_code == 200 :
data = json. loads ( response.text )
print ( data )
Output {
id : 1 , movie : 'The Shawshank Redemption' ,
rating : 9.2 , image : 'images/shawshank.jpg' ,
imdb_url : 'https: //www.imdb.com/title/tt0111161/'
}
Create a User
This allows you to create a new entry in our users
route. Be aware that you can’t create a new user with an id that already exists.
Note: At this moment we only support creating new resources in the /api/users
route.
fetch ( ' https://dummyapi.online/api/users ' , {
method: ' POST ' ,
body: JSON . stringify ({
id: 11 ,
name: " Elon Musk " ,
username: " elonmusk " ,
email: " elonmusk@planet.mars "
}),
headers: {
' Content-type ' : ' application/json '
},
})
. then ( ( response ) => response . json ())
. then ( ( json ) => console . log ( json ));
import requests
import json
url = ' https://dummyapi.online/api/users '
headers = { ' Content-type ' : ' application/json ' }
data = {
' id ' : 11 ,
' name ' : ' Elon Musk ' ,
' username ' : ' elonmusk ' ,
' email ' : ' elonmusk@planet.mars '
}
response = requests. post ( url , headers = headers , json = data )
if response.status_code == 200 :
print ( json. loads ( response.text ))
else :
print ( f "Failed to make the request. Status code: {response.status_code} " )
Output {
"message" : " User created successfully: " ,
id : 11 ,
name : " Elon Musk " ,
username : " elonmusk " ,
email : " elonmusk@planet.mars "
}
Important: Please note that resources will not be actually updated on our server, but you will receive a legitimate response as if they were!