如何将api密钥发送到pushbullet api

时间:2014-05-28 10:04:25

标签: api

我尝试从pushpullet API获取设备列表

我正在使用此代码

string api = "my api key";
        string url = "https://" + api + ":@api.pushbullet.com/v2/devices";
        Uri uri = new Uri(url);
        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
        request.Method = "GET";

        string result = string.Empty;
        using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
        {
            using (Stream responseStream = response.GetResponseStream())
            {
                using (StreamReader readStream = new StreamReader(responseStream, Encoding.UTF8))
                {
                    result = readStream.ReadToEnd();
                }
            }
        }

我得到401"没有提供有效的API密钥。"

当我在postman

上试用时

它的工作正常,我收到了回复。pushbullet api

0 个答案:

没有答案