The Movie Database Support

Hi everyone, I am developing a simple app for learning purposes, which uses the movie db APIs. The code i am using to perform http requests to is the following:

   HttpURLConnection connection;
    try {
        /* starting http request */
        connection = (HttpURLConnection) url.openConnection();

        /* reading the response */
        BufferedReader rd;
        if(connection.getResponseCode() != 200){
            rd = new BufferedReader(new InputStreamReader(connection.getErrorStream()));
        } else {
            rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));

        StringBuilder content = new StringBuilder();
        String line;
        while ((line = rd.readLine()) != null) {

        /* returning it to the caller */
        return content.toString();
    } catch (IOException e){
        Log.v(TAG, "Problems connecting to the server: " + e.getMessage());
        return "";

This code is working perfectly to retrieve a list of movies, with a url like:[your api key]&page=1

But to retrieve the list of videos for a movie, so a url like:[your api key]

is not working! getResponseCode() returns to me 404 and in the error stream i read:

{“status_code”:34,“status_message”:“The resource you requested could not be found.”}

The odd thing is that if with the debugger i copy the url the code is working on and copy it on my browser it works as expected (showing me the json response).

Any chance someone can help me with this issue?

2 replies (on page 1 of 1)

Jump to last post

I solved it. It was the connection.setDoOutput(true)

Hi @wellsaid2, happy to hear it. Hopefully that can help other people in the future!


s focus the search bar
p open profile menu
esc close an open window
? open keyboard shortcut window

On media pages

b go back (or to parent when applicable)
e go to edit page

On TV season pages

(right arrow) go to next season
(left arrow) go to previous season

On TV episode pages

(right arrow) go to next episode
(left arrow) go to previous episode

On all image pages

a open add image window

On all edit pages

t open translation selector
ctrl+ s submit form

On discussion pages

n create new discussion
w toggle watching status
p toggle public/private
c toggle close/open
a open activity
r reply to discussion
l go to last reply
ctrl+ enter submit your message
(right arrow) next page
(left arrow) previous page