Free fake API created by a backend developer
for frontend developers to use
Get all users. Total users is 1000
Endpoint: https://fake.newbapi.com/user/api/v1/users/
// JavaScript fetch() all users
fetch('https://fake.newbapi.com/user/api/v1/users/')
.then(response => response.json())
.then(data => {
console.log(data);
}).catch(error => {
console.error(error);
});
Example Output
// JavaScript fetch() all users
[
{
"id": 1,
"title": "Mr",
"first_name": "Sayre",
"last_name": "Wloch",
"email": "[email protected]",
"gender": "Male",
"address": {
"country": "Kosovo",
"city": "Vitina",
"street_name": "Green",
"street_address": "7018 Northview Place"
},
"is_active": true
},
{
"id": 2,
"title": "Dr",
"first_name": "Amelina",
"last_name": "Trewhella",
"email": "[email protected]",
"gender": "Female",
"address": {
"country": "Greece",
"city": "Vokhaïkó",
"street_name": "Rigney",
"street_address": "0235 Paget Court"
},
"is_active": true
},
...
...
// 100 users
]
Get user with limit, suitable for pagination or easy load data.
Endpoint: https://fake.newbapi.com/user/api/v1/users/?skip=0&limit=10
// JavaScript fetch() Pagination
fetch('https://fake.newbapi.com/user/api/v1/users/?skip=0&limit=10')
.then(response => response.json())
.then(data => {
console.log(data);
}).catch(error => {
console.error(error);
});
Example Output
// JavaScript fetch() Pagination
[
{
"id": 1,
"title": "Mr",
"first_name": "Sayre",
"last_name": "Wloch",
"email": "[email protected]",
"gender": "Male",
"address": {
"country": "Kosovo",
"city": "Vitina",
"street_name": "Green",
"street_address": "7018 Northview Place"
},
"is_active": true
},
{
"id": 2,
"title": "Dr",
"first_name": "Amelina",
"last_name": "Trewhella",
"email": "[email protected]",
"gender": "Female",
"address": {
"country": "Greece",
"city": "Vokhaïkó",
"street_name": "Rigney",
"street_address": "0235 Paget Court"
},
"is_active": true
},
...
...
// 10 users, page 0, 0 + n
]
Get single user.
Endpoint: https://fake.newbapi.com/user/api/v1/users/1
// JavaScript fetch() single user
fetch('https://fake.newbapi.com/user/api/v1/users/1')
.then(response => response.json())
.then(data => {
console.log(data);
}).catch(error => {
console.error(error);
});
Example Output
// JavaScript fetch() single user
{
"id": 1,
"title": "Mr",
"first_name": "Sayre",
"last_name": "Wloch",
"email": "[email protected]",
"gender": "Male",
"address": {
"country": "Kosovo",
"city": "Vitina",
"street_name": "Green",
"street_address": "7018 Northview Place"
},
"is_active": true
}
That's it 🎉