CARVIEW |
Select Language
HTTP/2 301
date: Sat, 02 Aug 2025 14:01:00 GMT
content-type: text/html; charset=UTF-8
access-control-allow-credentials: true
content-security-policy: default-src 'none'
location: /guide/
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=aNwS%2FvJMnNkuv%2F29Z6yILEyOUGA%2BG4Kqgb4%2BZCINchQ%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1754127289"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=aNwS%2FvJMnNkuv%2F29Z6yILEyOUGA%2BG4Kqgb4%2BZCINchQ%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1754127289"
server: cloudflare
vary: Origin, Accept-Encoding
via: 2.0 heroku-router
x-content-type-options: nosniff
x-powered-by: Express
x-ratelimit-limit: 1000
x-ratelimit-remaining: 999
x-ratelimit-reset: 1754127305
age: 15971
cache-control: max-age=43200
cf-cache-status: HIT
cf-ray: 968e1ad34e62563e-BOM
alt-svc: h3=":443"; ma=86400
HTTP/2 200
date: Sat, 02 Aug 2025 14:01:00 GMT
content-type: text/html; charset=UTF-8
access-control-allow-credentials: true
cache-control: public, max-age=43200
cf-cache-status: HIT
last-modified: Fri, 01 Aug 2025 20:00:59 GMT
nel: {"report_to":"heroku-nel","response_headers":["Via"],"max_age":3600,"success_fraction":0.01,"failure_fraction":0.1}
report-to: {"group":"heroku-nel","endpoints":[{"url":"https://nel.heroku.com/reports?s=48FabAdKG9wIBsmTKhhFpwFhGSi479XhUNzc3NMVuBg%3D\u0026sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d\u0026ts=1754086547"}],"max_age":3600}
reporting-endpoints: heroku-nel="https://nel.heroku.com/reports?s=48FabAdKG9wIBsmTKhhFpwFhGSi479XhUNzc3NMVuBg%3D&sid=e11707d5-02a7-43ef-b45e-2cf4d2036f7d&ts=1754086547"
server: cloudflare
vary: Origin, Accept-Encoding
via: 2.0 heroku-router
x-powered-by: Express
x-ratelimit-limit: 1000
x-ratelimit-remaining: 998
x-ratelimit-reset: 1754086565
age: 15970
content-encoding: gzip
cf-ray: 968e1ad36e82563e-BOM
alt-svc: h3=":443"; ma=86400
JSONPlaceholder - Guide
JSONPlaceholder
Guide
Below you'll find examples using Fetch API but you can JSONPlaceholder with any other language.
You can copy paste the code in your browser console to quickly test JSONPlaceholder.
Getting a resource
fetch('https://jsonplaceholder.typicode.com/posts/1')
.then((response) => response.json())
.then((json) => console.log(json));
👇 Output
{
id: 1,
title: '...',
body: '...',
userId: 1
}
Listing all resources
fetch('https://jsonplaceholder.typicode.com/posts')
.then((response) => response.json())
.then((json) => console.log(json));
👇 Output
[
{ id: 1, title: '...' /* ... */ },
{ id: 2, title: '...' /* ... */ },
{ id: 3, title: '...' /* ... */ },
/* ... */
{ id: 100, title: '...' /* ... */ },
];
Creating a resource
fetch('https://jsonplaceholder.typicode.com/posts', {
method: 'POST',
body: JSON.stringify({
title: 'foo',
body: 'bar',
userId: 1,
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((json) => console.log(json));
👇 Output
{
id: 101,
title: 'foo',
body: 'bar',
userId: 1
}
Important: resource will not be really updated on the server but it will be faked as if.
Updating a resource
fetch('https://jsonplaceholder.typicode.com/posts/1', {
method: 'PUT',
body: JSON.stringify({
id: 1,
title: 'foo',
body: 'bar',
userId: 1,
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((json) => console.log(json));
👇 Output
{
id: 1,
title: 'foo',
body: 'bar',
userId: 1
}
Important: resource will not be really updated on the server but it will be faked as if.
Patching a resource
fetch('https://jsonplaceholder.typicode.com/posts/1', {
method: 'PATCH',
body: JSON.stringify({
title: 'foo',
}),
headers: {
'Content-type': 'application/json; charset=UTF-8',
},
})
.then((response) => response.json())
.then((json) => console.log(json));
👇 Output
{
id: 1,
title: 'foo',
body: '...',
userId: 1
}
Important: resource will not be really updated on the server but it will be faked as if.
Deleting a resource
fetch('https://jsonplaceholder.typicode.com/posts/1', {
method: 'DELETE',
});
Important: resource will not be really updated on the server but it will be faked as if.
Filtering resources
Basic filtering is supported through query parameters.
// This will return all the posts that belong to the first user
fetch('https://jsonplaceholder.typicode.com/posts?userId=1')
.then((response) => response.json())
.then((json) => console.log(json));
Listing nested resources
One level of nested route is available.
// This is equivalent to /comments?postId=1
fetch('https://jsonplaceholder.typicode.com/posts/1/comments')
.then((response) => response.json())
.then((json) => console.log(json));
The available nested routes are: