AI Workshop: learn to build apps with AI →
Fetch: POST requests

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


Fetch also allows you to use other HTTP methods: POST, PUT, DELETE, or OPTIONS.

Specify the method in the method property of the request and pass additional data in the headers and body:

Example of a POST request:

const options = {
  method: 'post',
  headers: {
    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
  },
  body: 'name=Flavio&test=1'
}

fetch(url, options).catch(err => {
  console.error('Request failed', err)
})

Lessons in this unit:

0: Introduction
1: How to use Fetch
2: Catching errors in network requests
3: The Response object
4: Getting the body content
5: The Request object
6: Request headers
7: ▶︎ POST requests