如何在对oxford词典api的请求中添加请求标头?

时间:2018-03-17 04:43:07

标签: c# asp.net api

我正在编写一个简单的ASP.NET程序来使用OXFORD Dictionary API,我对如何在请求中添加请求标头表示怀疑。 这就是我这样做的方式

protected void Page_Load(object sender, EventArgs e)
{

HttpWebRequest req = null;
public static string PrimeUrl = "https://od-api.oxforddictionaries.com:443/api/v1/entries/en/";
public static string uri = PrimeUrl + "robot";
req = (HttpWebRequest)HttpWebRequest.Create(uri);         
req.Headers.Add("app_id", "72536848");
req.Headers.Add("app_key", "0b4ed44eefa341a4e5cc42ec");
req.Method = WebRequestMethods.Http.Get;
req.Accept = "application/json"; 

}

上面的代码片段发现有错误,有没有人对使用牛津词典api有任何先验知识?如果是的话,请帮忙。

0 个答案:

没有答案