Page 1 of 1

cURL request

Posted: 06 May 2016 18:15
by mathieson
Hello Martin,

I am sorry to be bothersome, I am trying to figure this out.

I am using the HTTP Request action to get a json response.

In cURL I would do:

curl -H "Content-Type: application/json" -H "mymagickeyhere" -X POST -d '{"path":"/root/status"}' https://api.onion.io/v1/devices/mydevic ... /file/read

So, I believe I should:

URL:
https://api.onion.io/v1/devices/mydevic ... /file/read

Request Method: POST

Form Field List:
path=/root/status

Set custom HTTP headers:
"Content-Type: application/json"
"mymagickeyhere"

However I keep getting an empty response. Any ideas as to why this might be?

Thanks for all your help.

If you would like I can send you the key and uuid via email.

Re: cURL request

Posted: 09 May 2016 19:20
by Martin
Hi,

Could you please post a flow containing just this action so I can test with the exact same values? You can also send it privately to info@automagic4android.com if it contains values you don't want to disclose publicly.

I'm not using curl often so I'm not very familiar with the options. Why is there no header specified for mymagickeyhere? Did you just remove it for security reasons?
It also seems to miss curly braces and double quotes in the value specified in the form field list. The value probably has to be written as: {'{"path":"/root/status"}'} to avoid that Automagic interprets the curly braces.

Regards,
Martin

Re: cURL request

Posted: 10 May 2016 15:05
by mathieson
Martin, thanks for the help.

I am putting this here for anyone in case they would like to use the Onion Omega cloud in the future:

Use the HTTP Request action with the following parameters:

URL:
https://api.onion.io/v1/devices/<device ... y=<API-key>
(adjust as needed for other services, the Onion Cloud console will give you the correct URL, just add ?key=... at the end)

Request Method:
POST

Content Type:
General Text
then change to application/json

Data:
{'{"parameter1":"value1","parameter2":"value2"....}'}

And Bob's your uncle!

Hope it is of use to someone else.