2016-06-01 28 views
1

を取得する私は、次のリクエストがありますYouTubeのAPIの検索がエラー

https://www.googleapis.com/youtube/v3/search?part=snippet&location=+37.42307%2C-122.08427&locationRadius=1500mi&q=israel&access_token=ya29.CjHzAvvmL97PFzMkIopmF9nT4IVdznARs30XrE5i1_i6j3eQxBlbNdktch2iIHqz1-x7

をそして私は、次のエラーが表示さ:エラーメッセージは、あなたがtypeを定義する必要が言うように

{ 
    error: { 
    errors: [ 
     { 
     domain: "youtube.search", 
     reason: "invalidSearchFilter", 
     message: "The request contains an invalid combination of search filters and/or restrictions. Note that you must set the <code>type</code> parameter to <code>video</code> if you set a value for the <code>eventType</code>, <code>videoCaption</code>, <code>videoCategoryId</code>, <code>videoDefinition</code>, <code>videoDimension</code>, <code>videoDuration</code>, <code>videoEmbeddable</code>, <code>videoLicense</code>, <code>videoSyndicated</code>, or <code>videoType</code> parameters.", 
     locationType: "parameter", 
     location: "" 
     } 
    ], 
    code: 400, 
    message: "The request contains an invalid combination of search filters and/or restrictions. Note that you must set the <code>type</code> parameter to <code>video</code> if you set a value for the <code>eventType</code>, <code>videoCaption</code>, <code>videoCategoryId</code>, <code>videoDefinition</code>, <code>videoDimension</code>, <code>videoDuration</code>, <code>videoEmbeddable</code>, <code>videoLicense</code>, <code>videoSyndicated</code>, or <code>videoType</code> parameters." 
    } 
} 

答えて

1

をパラメータをvideoに設定します。

だからあなたの呼び出しは、このようなものでなければなりません。

https://www.googleapis.com/youtube/v3/search?part=snippet&location=37.42307,22.08427&locationRadius=50km&q=israel&access_token=ya29.CjHzAvvmL97PFzMkIopmF9nT4IVdznARs30XrE5i1_i6j3eQxBlbNdktch2iIHqz1-x7&type=video

また、APIはlocationRadiusパラメータは千キロを超える値は、あなたが1500miよりも小さいを定義する必要がサポートしていません(Reference

あなたがテストすることができ、すべてのパラメータhere

最後に、あなたのaccess_tokenを公開しないでください。それは秘密になっているはずです。あなたは公開してから変更する必要があります。あるいは、誰かが自分のニーズにそれを使うことができます。

関連する問題