Question

https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails,player,recordingDetails,statistics,status&id=-Ji6qekcLxM,-rJOifcv3HA,0CN5MvWQwac,0xZLb7zjel8,1JAWiDZbkI0,1TIzLB_L8lk,2Eh08z-eIaE,2zdhM5m9sqQ,3LVjhhYFLTw,4owWEERuFYM,5t5SSBotwC4,6ML-CT4tiFw,7FaPvb72nh4,8c9N_WZbBY8,8dFj1Es8x0w,9HxESrz8UUk,AE_a3SJBhxo,AM5O9iPCw0U,DZktPAbHIfY,GYaLo04ckPQ,MMBtlPlbSzg,Nfy0vyaWJRo,OneZeR09P_c,RZAo93F5Roo,VfE1VyiGHD8,VhLQj7Z42Ho,VjXYAFXPayo,W-DdJZL9EOA,XYEF1H6HsTE,XlxVR4aDt4Y,YKxOYkzndlk,Z7exBz2PbyU,cFV4Gp9llBI,crqkHbMp0P8,damF3y8PC-Y,eJ79X5qR3pw,fHuNLi61nV0,iXJRgHXDY_o,jJ-XEAZCFus,kwnPrVQURg8,m40j71fet9o,nsjpgiramd0,paTpsjtsk9E,pzPjqe_UsO0,qzG-1gLm2sA,rRctYmNSln8,tpXcVmPEKeQ,uYbtNouVQBI,vEZWuM8Y6gQ,xKmrmmslPGo,yn9ceFwo1H8,zcxH8jQQu0A&maxResults=50&key={MyKey}

and I am using the following method to get response but it giving some error as per My Observation there is some new video id which showing some error

private JSONObject getResponse(String apiUrl) {
        HttpClient client = new DefaultHttpClient();
        HttpUriRequest request = new HttpGet(apiUrl);
            try {
                HttpResponse response = client.execute(request);
                String jsonString = StreamUtils.convertToString(response.getEntity().getContent());
                JSONObject mJson = new JSONObject(jsonString);
                return mJson;
            } catch (ClientProtocolException e) {           
                e.printStackTrace();
            } catch (Exception e) {
            }
    return null;
}

The error in response is as following

400 Bad Request

- Show headers -

{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "invalidFilters",
"message": "Bad Request",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Bad Request"
}
}
Was it helpful?

Solution

The above error was due to the no of Video Id's i was passing

The max page size is 50 and i was passing more than 50 video id so it was showing error

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