How to process a POST response?

Hello ST developers,
maybe you can help me here,
I am trying to write a Device handler to send REST commands to Rompr.
The commands are sent using POST, and am trying to find how to process the response.

  1. My initial code uses the, new physicalgraph.device.HubAction method , with a callback , hoping to catch the response:

try {
//sendHubCommand(new physicalgraph.device.HubAction([
def hubAction = new physicalgraph.device.HubAction([
method: method,
path: path,
body: command,
headers: headers],
[callback: “hubActionResponse”]
hubAction.options = [outputMsgToS3:true]
log.debug(“Print hubAction: $hubAction”)

} catch (e) {

but in the callback, I get no print for the response, so I guess this is not called.
2. I tried to use the def parse(response) , but even there the response is not printed out. see code above.
So how to get the response from my POST call?
3. some code has: log.debug “name”. Other log.debug(“name”) are they both legal?

You’re in complicated territory.

First why are you setting outputMsgToS3 to true?

Also see this thread:

I dropped the line with the outputMsgToS3, and my callback worked. Yay!
so I remove my callback so the def parse() will be used:

def hubAction = new physicalgraph.device.HubAction([
	method: method,
	path: path,
	body: command,
	headers: headers],


but my parse() is not called. why?

Uninstall and reinstall the device. I’ve noticed that when one way is registered you can’t switch on the fly to the other.

Also have you registered the DNI?

Dear @RBoy,
Are you the only kind helper?
Here is my fixed device handler

What do you mean by register my DNI?
With the new handler, my parse() is still not invoked.
what to do?

If the callback is working, I’d say stick to that. It’s difficult to get both to work at the same time. There are more advantages to using callbacks, I believe that ST may eventually do away with DNI

Sorry, what is DNI?
is that the parse method?
and another issue:
in my callback I print the object I get, it is not the POST response and the json is missing.

DNI is the device network id, if you’re using callbacks you don’t need to worry about it. Make sure you dont set device.deviceNetworkId and you pass null for the dni in HubAction.

Refer to my previous post link for a list of available methods for a callback. If’s possible that POST may not return any data unless there’s an error

Here is my current try with a simple GET to / which should respond with a HTML.
but the callback is not ran.
What should be the value of the deviceNetworkId when I first setup the device in my IDE ? the wesite wont allow me to leave it empty, so I tried to put NULL…
Must my code remove value in device.deviceNetworkId ?
And why am I getting no log line with this test