The Movie Database Support

While any developer will be able to fix the error I thought you may want to fix your API documentation for C#. The below will produce a runtime error.

var request = System.Net.WebRequest.Create("http://themoviedb.apiary.io/3/movie/{id}") as System.Net.HttpWebRequest;
request.Method = "GET";
request.Headers.Add("Accept", "application/json");
request.ContentLength = 0;
string responseContent;
using (var response = request.GetResponse() as System.Net.HttpWebResponse) {
  using (var reader = new System.IO.StreamReader(response.GetResponseStream())) {
    responseContent = reader.ReadToEnd();
  }
}

Fix:

var request = System.Net.WebRequest.Create("http://themoviedb.apiary.io/3/movie/{id}") as System.Net.HttpWebRequest;
request.Method = "GET";
request.Accept = "application/json";
request.ContentLength = 0;
string responseContent;
using (var response = request.GetResponse() as System.Net.HttpWebResponse) {
  using (var reader = new System.IO.StreamReader(response.GetResponseStream())) {
    responseContent = reader.ReadToEnd();
  }
}

Or a more complete example

var request = (HttpWebRequest)WebRequest.Create(string.Format("http://api.themoviedb.org/3/movie/{1}?api_key={0}", ApiKey, tmdb));
request.Method = "GET";
request.Accept = "application/json";
request.Headers.Add("Accept-Charset", "UTF-8");
request.ContentLength = 0;
string json;
using (var response = request.GetResponse() as HttpWebResponse)
{
    if (null != response && HttpStatusCode.OK == response.StatusCode)
    {
        using (var reader = new StreamReader(response.GetResponseStream()))
        {
            json = reader.ReadToEnd();
        }
    }
}

2 replies (on page 1 of 1)

Jump to last post

Hi Michael,

Thanks for sharing. Those examples are created automatically by Apiary. I'll have to let them know.

Thanks Travis, I wasn't sure how much control you had over it. Feel free to set the status to closed.

Can't find a movie or TV show? Login to create it.

Global

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

Settings

Want to rate or add this item to a list?

Login