Docs

CRUD

As well as fetching resources, you can simulate interacting with them.

NOTE: None of these actually update anything on the server.

Create with POST

fetch('https://api.placeholderjson.dev/shipments', {
  method: 'POST',
  body: JSON.stringify({orderID: "ABC1234"}),
  headers: {
    'Content-Type': 'application/json'
  }
})
.then(response => response.json())
.then(json => console.log(json))

Return value:

{
  success: true,
  orderID: "ABC1234"
}

Update with PUT

fetch('https://api.placeholderjson.dev/boarding-pass/2KPFW08X5O', {
  method: 'PUT',
  body: JSON.stringify({seat: "29D"}),
  headers: {
    'Content-Type': 'application/json'
  }
})
.then(response => response.json())
.then(json => console.log(json))

Return value:

{
  success: true,
  seat: "29D"
}

Delete with DELETE

fetch('https://api.placeholderjson.dev/job-listings/1', {
  method: 'DELETE',
  headers: {
    'Content-Type': 'application/json'
  }
})
.then(response => response.json())
.then(json => console.log(json))

Return value:

{
  success: true
}