0

I'm attempting to change the stream title using the Twitch API and I'm getting a 404 error. I referred to the docs here and followed its example but no luck.

var axios = require('axios');

headers = {
    'Authorization':'Bearer [token]',
    'Client-Id':'[client id]',
    'Content-Type':'application/json'
}

data = {
    'title':'changed title'
}

axios.post('https://api.twitch.tv/helix/channels?broadcaster_id=[broadcaster id]', data, {'headers':headers}).then(resp => {
    console.log(resp.data);
}).catch(err => console.error(err))
RyanPython
  • 412
  • 1
  • 5
  • 14

1 Answers1

0

Ok so I learnt 2 things:

  1. the API documentation said the method should be PATCH, not POST. So it should be axios.patch, not axios.post

  2. the broadcaster ID must match the Authorization token + client ID (I'm using two different accounts for streaming and the twitch chat bot)

RyanPython
  • 412
  • 1
  • 5
  • 14