I'm at the end of my patience with this. This is was the first roadblock I had writing code on the smartthings platform, and I'm getting ready to start smashing my laptop to pieces, so I would greatly appreciate some assistance.
def refreshToken(){
refresh = state.refreshToken
jsonMaps= '{"refresh_token":'refresh'}'
def postParams = [
uri: "https://frdtyujk.requestcatcher.com/",
requestContentType: 'application/json',
contentType: 'application/json',
body: ['user': ['refresh_token': refresh]]
]
asynchttpPost('token', postParams)
}
I am trying to get the above's body to look exactly like what is below when it is received by the api.
{
"user": {
"refresh_token": "someToken"
}
}
I am attempting to reference a state token. The only way I've been able to get the proper token received by the API is by mutilating the json. Nearly everything I try results in a failure to save the driver, a failure to make the call, or a 404. I do not know coding, I know only what I"ve been able to discern. I have played with quotations, brackets, single quote and parenthesis' and the placement of these things until I was ready to punch my laptop's monitor. Why is this is so freaking difficult? Yes, I am aware there is documentation. The documentation as far as I am aware does not explain how to get groovy to understand it is not the most important thing in the world