0
我必須將訂閱數據提交給其他網站。我有關於如何使用這個API的文檔,但是我不是100%確定如何設置它。我有所需的所有信息,如用戶名/密碼等通過API訂閱.net C#
這是API文檔:
https://www.apiemail.net/api/documentation/?SID=4
如何將我的請求/後/不管看起來像在C#.NET(VS 2008 )當我試圖訪問此API?
這是我現在,我覺得我不是在正確的軌道上:
public static string GArequestResponseHelper(string url, string token, string username, string password)
{
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
myRequest.Headers.Add("Username: " + username);
myRequest.Headers.Add("Password: " + password);
HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
Stream responseBody = myResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader readStream = new StreamReader(responseBody, encode);
//return string itself (easier to work with)
return readStream.ReadToEnd();
希望有人知道如何正確設置它。謝謝!