LOGBOOK

HELP

Quiz Entry - updated: 2026.06.20

How do you send data with a POST request using fetch?

Set the options method to 'POST' and pass the payload as the body, serializing objects with JSON.stringify().

const response = await fetch('/api/users', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'Alice',
    email: 'alice@example.com'
  })
});

For JSON data, stringify the object and set the appropriate Content-Type header.

From Quiz: WEBT / Backend Integration | Updated: Jun 20, 2026