httpGet changed?

Guys
did the response from httpGet change in any way?

This code:

def paramsUD = [uri: "https://raw.githubusercontent.com/CobraVmax/Hubitat/master/versions/cobra.json"]
   try {
    httpGet(paramsUD) { respUD ->
  //   log.info "response data: ${respUD.data}"
   def copyNow = (respUD.data.versions.copyright)
   state.copyrightNow = copyNow
   def cobraVer = (respUD.data.versions.(state.InternalName))
   def cobraOld = state.appversion.replace(".", "")
   if(cobraOld < cobraVer){
		state.verCheck = "** New Version Available **"
       log.warn "There is a newer version of this app available"
   }    
   else{ 
  state.verCheck = "Current"
   }
   
   }
    } 
    catch (e) {
    log.error "Something went wrong: $e"
}
}        

Worked perfectly until recently

Now I get this error...

So what changes were made that I missed?

Andy

There were no changes to httpGet, but it appears that you changed the file in github. I ran that url through postman and it is returning "text/plain" for the content type, so that is why it is not being parsed into an object and instead is just giving you a String back.

Yes, I changed the location in an effort to try and see if it was related

The original file was http://update.hubitat.uk/cobra.json

Is this file also showing as text?

Andy

Nope, that comes back with application/json:

Thanks Chuck
I’ll try again with this file

Andy

Chuck
thanks for all your help
I found a missing comma in the json file !
I'm an idiot!

All working now

Andy

I found that helpful. Like a lot of syntax problems, jsonlint doesn't come out and say "hey, missing comma" but it does say good/bad quite well. And sometimes that's half the battle !!

The site says you can enter a URL and it'll scrape it for JSON but it doesn't follow links. Browsing to your JSON and then entering THAT URL yields the warm: Valid JSON :slight_smile:

I edit with Atom text editor and it does a nice job of pointing out my mistakes. Nice when working on an RPi image file too. You can see, edit and delete the hidden files.

1 Like

Thanks for the info guys
I need to be more careful and not blame Hubitat :slight_smile:

Andy