Question

Good day. Im trying to change stream title via this code:

titleStr = "Playing cool new game!";

$.ajax({
            url: 'https://api.twitch.tv/kraken/channels/my_channel?channel[status]='+titleStr+'&oauth_token=' +token,
            type: 'PUT',
            dataType : 'jsonp',
            contentType: 'application/json',
            success: function(data) {
              console.log(data.status);
            }
});

It returns succsess (current title), but nothing changes. However i tested url with Chrome App named Postman and its perfectly works.

UPD: Twitch API

Was it helpful?

Solution

Finally solved. Twitch api have an undoc feature '&_method=put' thru 'GET' =\

$.ajax({
            url: 'https://api.twitch.tv/kraken/channels/mychannel?channel[status]='+titleStr+'&oauth_token=' +token+'&_method=put',
            type: 'GET',
            contentType: 'application/json',
            dataType: 'jsonp',
            success: function(data) {
              console.log(data.status);
            }
}); 

This code works well.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top