I am building a driver for a device, that needs to get the setup from a webservice, in a json format.
I am doing all the HTTP Get, Json Parser, and getting everything as I read in the posts, history, old issues with HTTP get and jsson - but still can't figure out what might be going on.
The result.data = already comes in a broken version, not json.
If you do the http link directly via browser, the json is properly formatted.
While when you do the http get via driver, it already comes broken.
I recompiled a small version of the driver, here below, with only the functions needed to do the HTTP.
1- The link for the webservice with the json return:
https://molsmart-integration.web.app/controle-integration?token=eyJhbGciOiJIUzI1NiJ9.eyJpZCI6OSwibmFtZSI6IlNhbXN1bmcgTW9kZWxvIDEgKGNhc2EgcmFwaGEpIiwicHJpdmF0ZSI6dHJ1ZSwidXNlcl9pZCI6NH0.ONe1pZOrDMb4SGfJWOIl7WCtsz7a_pguAS4Ug0ERqVE
2- This is the part of the code for the http below:
def parseJson(resp)
{
def jsonSlurper = new groovy.json.JsonSlurper()
try
{
resp_json = jsonSlurper.parseText(resp.toString())
return resp_json
}
catch (Exception e)
{
log.warn "parse failed: ${e.message}"
return null
}
}
def httpGetExec()
{
logDebug("httpGetExec()")
try
{
httpGet(webserviceurl)
{ resp ->
if (resp.data)
{
logDebug("resp.data = ${resp.data}")
return resp.data
}
}
}
catch (Exception e)
{
logDebug("httpGetExec() failed: ${e.message}")
}
}
These are the logs: As you can see the result.data is already wrong formatted without "{"
And here the clean response json in browser.
Any ideas ? Thanks!!!