GroveStreams

Error - HttpResponseException not logging371

Muffinhead private msg quote post Address this user
I am trying to get the example routine running with my Smartthings home system. I've followed the instructions step by step but I get a Log Error through my Smartthings Log which is the following:
groovyx.net.http.HttpResponseException: Bad Request @ line 134

I'm running the code at the bottom of this page:
https://grovestreams.com/developers/getting_started_smartthings.html


Any help?
Post 1 IP   flag post
MikeMills private msg quote post Address this user
Engage GS API tracing to see if your call is even making it to your GS organization. If it is not, then your URL or the GS API key has issues.
Post 2 IP   flag post
Muffinhead private msg quote post Address this user
Thanks Mike, I found someone that had a similar issue on the forum and they posted code that I've tried. This fixed whatever problem I had:
private sendValue(evt, Closure convert) {
def compId = URLEncoder.encode(evt.displayName.trim())
def streamId = evt.name
def value = convert(evt.value)

log.debug "Logging to GroveStreams ${compId}, ${streamId} = ${value}"

def url = "https://grovestreams.com/api/feed?api_key=${apiKey}&compId=${compId}&${streamId}=${value}"

//Make the actual device the origin of the message to avoid exceeding 12 calls within 2 minutes rule:
//https://forum.grovestreams.com/topic/155/10-second-feed-put-limit-algorithm-change/
def header = ["X-Forwarded-For": evt.deviceId]

try {
def putParams = [
uri: url,
header: header,
body: []]

httpPut(putParams) { response ->
if (response.status != 200 ) {
log.debug "GroveStreams logging failed, status = ${response.status}"
}

}
} catch (groovyx.net.http.ResponseParseException e) {
// ignore error 200, bogus exception
if (e.statusCode != 200) {
log.error "Grovestreams: ${e}"
}
} catch (Exception e) {
log.error "Grovestreams: ${e}"
}
}
Post 3 IP   flag post
2968 3 3
Log in or sign up to compose a reply.