2017-08-04 7 views
0

このクエリは機能しますが、いくつかのoptionnalsパラメータを追加します。クエリパラメータtwitch API

Alert.prototype.getUserFollowedChannels = async function (user) { 
     return new Promise((resolve, reject) =>{ 
      var xhr = new XMLHttpRequest(); 
      xhr.open('GET', 'https://api.twitch.tv/kraken/users/' + user+ '/follows/channels?client_id=' + this.clientId, true); 
      //xhr.open('GET', 'https://api.twitch.tv/kraken/users/' + user+ '/follows/channels?client_id=' + this.clientId+'?limit=100', true); // try with what i want 
      xhr.onreadystatechange = function() { 
       if (xhr.readyState != 4 || xhr.status != 200) return; 
       var follows = JSON.parse(xhr.responseText); 
       if (follows) resolve(follows); 
       else resolve("none"); 
      } 
      xhr.send(); 
     }) 
} 

私のクエリのドキュメントがあります:https://dev.twitch.tv/docs/v5/reference/users/#get-user-follows

+0

のようなものを使用することができますか?それらはどう定義されていますか?いくつかのサンプルコードを追加してください。 – Matthew

+0

パラメータの詳細は次のドキュメントにあります。https://dev.twitch.tv/docs/v5/reference/users/#get-user-follows –

+0

オブジェクト(キー:値)を受け入れ、それを反復処理する関数を作成できますクエリパラメータの文字列を作成し、それを返し、URLに追加します – Matthew

答えて

0

オプションのパラメータを指定することができますあなたはquery-string

関連する問題