hi there, i'm writing a driver, looking to do asynchttpget to replicate what can be easily & reliably done with curl.
curl command which works fine:
curl --insecure -H “X-authID: abcdefg” -v “https://192.168.0.12/www/access?authKey=123456”
(reply is text/plain)
When making this call using asyncHttpGet, I keep getting a response status of 404 (not found), despite the fact that the debug logs show the URI and PATH fields to look perfect.
I have tried numerous header options, including a few different content types, Bearer Authorization using the authKey...but not sure where to go from here in terms of troubleshooting. Anyone have any ideas?
LOGS
debug GetHandler: asynchttp error {404}
trace errorData=ret=PARAM NG,msg=404 Not Found
trace errorMessage=Not Found
trace status=404
trace class=class hubitat.scheduling.AsyncResponse
trace warningMessages=[]
trace headers={Content-Length=30, Content-Type=text/plain}
debug getHandler: response status: {404}
debug Get() params: {[uri:https://192.168.0.12:443, path:/www/access?authKey=123456, requestContentType:text/plain, contentType:text/plain, headers:[X-authID:abcdefg, User-Agent:Hubitat, Accept:/], ignoreSSLIssues:true, timeout:5]}
CODE CHUNKS
queryPath = "/www/access?authKey=" + authKey
asyncGetParams = getParams(queryPath)
asynchttpGet("getHandler", asyncGetParams)
def getParams(qPath) {
def akey = device.currentValue("authKey")
def params = [
uri: "https://" + getHostAddress(),
path: qPath,
requestContentType: 'text/plain',
contentType: 'text/plain',
headers: [ "X-authID": akey, "User-Agent": "Hubitat", "Accept": "/" ],
ignoreSSLIssues: true,
timeout: 5
]
return params
}
def getHandler(getResp, data)
error checking & logging code