403 Error with free subscription

pkfoxpkfox Member

Hi guys I'm getting a 403 when I try using the API - this is the abridged quick and dirty C# code I'm using

        static HttpWebRequest req = null;
        static string uri = "https://od-api.oxforddictionaries.com/api/v2/entries/en-gb/";
        static string theJson = "";
        static HttpWebResponse HWR_Response = null;
        static Stream respStream = null;
        static StreamReader sr = null;
        static bool Found = false;
        static string app_id = "my app id"; // obviously this has the correct data
        static string app_key = "my app key"; // obviously this has the correct data
        static string SearchWord { get; set; }

        static void Main(string[] args)
            SearchWord = "test";
            uri += SearchWord;
            req = (HttpWebRequest)HttpWebRequest.Create(uri);
            req.Headers.Add("app_key", app_id);
            req.Method = WebRequestMethods.Http.Get;
            req.Accept = "application/json";

            // It bombs here with a 403 authentication  failure 
            HWR_Response = (HttpWebResponse)req.GetResponse();

Any ideas guys ?



Sign In or Register to comment.