cURL request

Post your questions and help other users.

Moderator: Martin

Post Reply
mathieson
Posts: 51
Joined: 13 Aug 2013 18:16

cURL request

Post by mathieson » 06 May 2016 18:15

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.

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: cURL request

Post by Martin » 09 May 2016 19:20

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

mathieson
Posts: 51
Joined: 13 Aug 2013 18:16

Re: cURL request

Post by mathieson » 10 May 2016 15:05

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.

Post Reply