I am trying to use the BART's API to get a response using RestSharp. Here is what I have so far:
var client = new RestSharp.RestClient("http://api.bart.gov/");
var request = new RestRequest ("");
request.AddParameter ("cmd", "stns");
request.AddParameter ("key", "MW9S-E7SL-26DU-VV8V");
IRestResponse response = client.Execute (request);
This should get a list of all Bart Stations. The stns parameter says to get all stations and the key is the API key.
However, when I try to print it out
Console.WriteLine (response.Content);
I get some weird document that says how to use BART API followed with some type of error that says
Unknown Server (64-126)
Any ideas? I suspect it might be a simple error with how I have the Parameters set up or the way the client is set up.
http://api.bart.gov/Are you sure this shouldn't behttp://api.bart.gov/api/stn.aspx? See the bottom of your linked documentation:Usage http://api.bart.gov/api/stn.aspx?cmd=stns&key=MW9S-E7SL-26DU-VV8V