Pingdom REST API de ASP clásico
-
29-10-2019 - |
Pregunta
Me gustaría usar la API REST de Pingdom del ASP clásico, pero el siguiente código:-
' 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
me da el error:-
{"error":{"statuscode":401,"statusdesc":"Unauthorized","errormessage":"User credentials missing"}}
Por lo tanto, mi autenticación no se está pasando correctamente, y parece que no debe aprobarse en el Solicitador, pero no estoy seguro de cómo se debe hacer.
Gracias
Gracias por Alex K. y en beneficio de otros, la sintaxis correcta es:-
' 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
:-)
Solución
https://api.pingdom.com/api/2.0/checks está utilizando la autenticación básica, por lo que debe aprobar sus credenciales en el .open
llamar.
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow