API Changes for Helix

Hi there,

I have a sample site I’ve been maintaining that has been recently affected by the new API Changes. I’ve been calling the Kraken API for the Top 25 trending clips, and since the changes to the helix API, my calls no longer works.

var vm = new Vue({
el:"#app",
data:{
Allclips: [],
Weeklyclips: [],
Show: ‘week’,
Keywords: ‘’

},

mounted(){
	let APIurl1="https://api.twitch.tv/kraken/clips/top?parent=test.pogchampz.com&language=en&limit=25&period=all"
	let APIurl2="https://api.twitch.tv/kraken/clips/top?parent=test.pogchampz.com&language=en&limit=25&trending=true"
	let clientId='my_client_id'
	let clientSecret='my_client_secret'
	let accessToken='my_access_token'



	function GetWeekly(){
	return axios({
	method:'get',
    url:APIurl2,
    headers:{
		'Client-ID': clientId,
		'Authorization': 'Bearer' + accessToken,
		'Accept': 'application/vnd.twitchtv.v5+json' 
	}
	})
	};	
	
	axios.all([GetWeekly()])
		.then(axios.spread(( Weeklyresponse)=>{
			this.Weeklyclips= Weeklyresponse.data.clips
		}))
	},

})

Can you please help me figure out how to migrate to the new helix API?

Thank you,
Pudy

Well you didn’t need this in kraken or helix for a start

You do not need this for helix

Covers the new “Get Clips” API

There is no way to get “trending clips across the whole site”

As for Helix Get Clips you need to declare a game_id or a broadcaster_id.

So you’d probably want to grab “Top Games” and then Clips for those games.

The migration guide v5 Migration Guide | Twitch Developers suggests the following

Get Top Clips Get Clips broadcast_id must be used in the new endpoint rather than the channel name used by the v5 endpoint.

Hi Barry,

Thanks for your quick response.

If i was trying to get top clips from say Twitch Streamer “Tfue”

curl -X GET 'https://api.twitch.tv/helix/clips?broadcaster_id=‘tfue’
-H 'Authorization: Bearer mytoken
-H 'Client-Id: myclientid

Does this look correct?

No you need the user ID for tfue not the username

so

curl -X GET '[https://api.twitch.tv/helix/clips?broadcaster_id=60056333
-H 'Authorization: Bearer mytoken
-H 'Client-Id: myclientid

Hi Barry,

I’ve been making some progress, I was able to successfully get a response using curl after generating a token with the twitch CLI. I’ve used that same token + client ID in my code but I seem to be getting a 401 response error " OAuth token is missing". I’m assuming this must have something to do with my Headers??


var vm = new Vue({
	el:"#app",
	data:{
		Allclips: [],
		Weeklyclips: [],
		Show: 'week',
		Keywords: ''

	},

	mounted(){
		let APIurl1="https://api.twitch.tv/helix/clips?broadcaster_id=60056333"
		let APIurl2="https://api.twitch.tv/helix/clips?broadcaster_id=60056333"
		let clientId="****************"
		let clientSecret="****************"
		let accessToken1="****************"
	
	

		function GetWeekly(){
		return axios({
		method:"get",
        url:APIurl2,
        headers:{
			"Client-ID": clientId,
			"Authorization": "Bearer" + accessToken1
			
  		}
		})
		};	
		
		axios.all([GetWeekly()])
			.then(axios.spread(( Weeklyresponse)=>{
				this.Weeklyclips= Weeklyresponse.data.clips
			}))
		},
})

You omitted the space after bearer and before your token

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.