我嘗試了一些方法,但似乎沒有人工作。 看http://heywatch.com/和對API http://wiki.heywatch.com/API+Documentation使用.NET的HeyWatch API連接問題
我們的API是基於REST原則,所以你只需要做的是一個HTTP請求到正確的資源和正確的描述方法。這個請求的URL總是相同的:http://heywatch.com或https://heywatch.com
要使用我們的API,你必須通過基本認證進行認證。
我有一個帳戶,並嘗試只使用http://heywatch.com/account.xml接收簡單的帳戶信息。
但沒有機會。我嘗試以下
Dim req As WebRequest = WebRequest.Create(Url & "account.xml")
req.Headers.Add(HttpRequestHeader.Authorization, "BASIC [USER]:[pass]")
req.Method = "GET"
我更換了頭爲userpass的東西與64位編碼太
我想也
Dim myCred As New NetworkCredential(ApiUser, ApiPass, ApiUrl)
Dim credCache As New CredentialCache
credCache.Add(New Uri(ApiUrl), "Basic", myCred)
req.Credentials = credCache
我後來試圖改變任何可能的屬性像UseDefaultCredentials
或AuthenticationLevel
我總是得到一個401沒有授權錯誤。請幫幫忙,謝謝;-)
BTW:已經有一個移植版本PHP,https://github.com/madewithlove/php-heywatch-class