Hello,
I want HTTP post request to particle cloud with function, I want to know what would be the format. I know in CURL. I want to post without the form.
Turn the LED on.
Turn the LED off.
Thanks, Adil
Hello,
I want HTTP post request to particle cloud with function, I want to know what would be the format. I know in CURL. I want to post without the form.
Thanks, Adil
What do you mean with that? Or rather how do you want to issue that POST request?
What language?
What tool?
...
I’m not very into in IOT but try to learn how to integrate Photon with my home controller (Homeseer 3).
I’m working on particle photon with Web-Connected LED application, with function LED and command “on”. I want to run this command on HTTP.
I run the http post with postman and working fine, and then convert into http from postman and it looks like that.
POST /v1/devices/3f0035000d47363330353437/led HTTP/1.1
Host: api.particle.io
Content-Type: application/x-www-form-urlencoded
access_token=<redacted>&arg=on
But my homeseer BIG5 pugin wants HTTP post in URL. so I don’t know how can use form data into it.
I refer cloud API but most of are in curl CLI. Please guide me where I can get more information and try.
I can learn if you guide me.
Thanks,
This is most likely a topic for the Homeseer and/or Big5 plugin forum - even when they don't assume responsibility this is not a question specific to Particle but on the way how you would create a POST request to any target from their side.
Have you tried the suggestion in the other thread?
However, you should never publicly post your access token - I removed it from this thread but I saw you have also posted it on other forums where we cannot protect your access token.
BTW, can you post a correction in this thread that this is not entirely true
The cloud service is free for the first 100 devices per account.
HI ScruffR,
I tried that suggested on Homeseer forum, but not successful. My token is not completed its missing some information. Your correct I;ll update about the monthly fee.
Can you guide me how can I write simple URL on the browser to call a function and pass argument?
Hi and welcome to the community!
maybe this can help you?
https://docs.particle.io/reference/device-os/firmware/photon/#particle-function-
You can find examples with CURL there, so one is like this:
curl https://api.particle.io/v1/devices/0123456789abcdef/brew
-d access_token=123412341234
-d "args=coffee"
Cheers!
Gustavo.
EDIT: oh darn, I re-read now and see this is not what you were asking for:
Thank you @ScruffR for your correction below.
You cannot just put such an URL into the browser's address bar as this would create a GET request not a POST.
When you tried the Homeseer suggestions, what did you put in the respective fields?
@gusgonnet, as I understand the matter the OP has already indicated that his functions work and he can trigger them via Postman. The issue at hand is primarily revolving abround the specific way how Homeseer (and plugins) needs to be fed with the data in order to make it issue the POST request the way CURL or Postman do.
When I ran the following URL it hit the API cloud but not turning the LED on. But provide all the respected feed pack from the device {Device ID and connected and return_value=-1}
https://api.particle.io/v1/devices/3f0035000d47363330353437/led?access_token=my token ID&arg=on
I want to know which format I pass the function form data.
Following print screen from command line.
The part starting with the question mark (?access_token...
) is not supposed to be part of the URL.
The access token and the function argument are supposed to go into the data payload of the request.
I don’t think it matters, but since the docs use args
rather than arg
you can try changing that too.
Although not knowing how Homeseer expects the three fields to be provided, I’d think they should be filled like this
URL
https://api.particle.io/v1/devices/3f0035000d47363330353437/led
Headers
Content-Type: application/x-www-form-urlencoded
Body
access_token=<yourAccessToken>&args=coffee
Great!
Thanks it’s work
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.