Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

fetch and edit jsonplaceholder api

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));
Source by jsonplaceholder.typicode.com #
 
PREVIOUS NEXT
Tagged: #fetch #edit #jsonplaceholder #api
ADD COMMENT
Topic
Name
2+2 =