2012-01-17 64 views
1

我想用从经典ASP的Pingdom的REST API,但下面的代码: -Pingdom的REST API从传统的ASP

' setup the URL 
baseUrl = "https://api.pingdom.com/api/2.0/checks" 

' setup the request and authorization 
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP") 
http.open "GET", baseUrl, False 
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
http.setRequestHeader "userpwd", "aaaaaaaaaaaaaaaaaaaaaaa:bbbbbbbbbbb" 
http.setRequestHeader "App-Key", "ccccccccccccccccccccccccccccccc" 

' send the HTTP data 
http.send 

给我的错误: -

{"error":{"statuscode":401,"statusdesc":"Unauthorized","errormessage":"User credentials missing"}} 

所以我身份验证没有被正确传递,看起来它不应该在requestheader中传递,但我不知道应该如何完成。

感谢

感谢亚历克斯K.和他人的利益,正确的语法是: -

' setup the URL 
baseUrl = "https://api.pingdom.com/api/2.0/checks" 

Response.Write fullUrl 
' setup the request and authorization 
Set http = Server.CreateObject("MSXML2.ServerXMLHTTP") 
http.open "GET", baseUrl, False, "emailaddress", "password" 
http.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
http.setRequestHeader "App-Key", "keykeykeykeykeykeykeykeykeykey" 

' send the HTTP data 
http.send 

:-)

回答