Replies: 2 comments
-
I'm not familiar with the hardware or API here, but I had a look at their API documentation: https://docs.particle.io/reference/cloud-apis/api/#call-a-function. It looks like this API is using x-www-form-urlencoded request bodies to pass parameters. In the HTTP Shortcuts app you can achieve this by opening the editor for your shortcut and then to the "Request Body / Parameters" section (make sure to set the method to POST first). Here you can set the "Request Body Type" dropdown to "Parameters (x-www-form-urlencoded). You should then be able to add your parameter with the plus-button at the bottom right. You don't need to encode the parameter in any way, you can just enter its name and value as-is. The name of the parameter is "arg", according to the documentation. Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Roland,
This worked perfectly. Thank you. I spend about 2 hours trying everything I could think of and nothing worked. I had read the documentation you referenced during my solution searching, but couldn’t make the connection to the necessary entry points in the HTTP Shortcuts app (which is an awesome app by the way).
Much appreciated and now I have my functionality back on the device.
Pat
From: Roland Meyer ***@***.***>
Sent: Friday, August 11, 2023 12:41 AM
To: Waboodoo/HTTP-Shortcuts ***@***.***>
Cc: patl1 ***@***.***>; Author ***@***.***>
Subject: Re: [Waboodoo/HTTP-Shortcuts] Sending Function Parameter to Particle Photon (Discussion #375)
I'm not familiar with the hardware or API here, but I had a look at their API documentation: https://docs.particle.io/reference/cloud-apis/api/#call-a-function.
It looks like this API is using x-www-form-urlencoded request bodies to pass parameters. In the HTTP Shortcuts app you can achieve this by opening the editor for your shortcut and then to the "Request Body / Parameters" section (make sure to set the method to POST first). Here you can set the "Request Body Type" dropdown to "Parameters (x-www-form-urlencoded). You should then be able to add your parameter with the plus-button at the bottom right. You don't need to encode the parameter in any way, you can just enter its name and value as-is. The name of the parameter is "arg", according to the documentation.
Hope this helps.
—
Reply to this email directly, view it on GitHub <#375 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/AG7WVZYKN3A3763NCAUYICLXUXO2BANCNFSM6AAAAAA3JEWH64> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/AG7WVZYWLLISB3GV7YMNBPTXUXO2BA5CNFSM6AAAAAA3JEWH66WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAMY356.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
I was able to get the app to communicate with my particle photon that controls a servo to close an HVAC vent in a remote location , however, the photon is only acknowledging the command when I leave out a parameter after the "ledState" function (shown below) and it processes it in the photon's firmware programmed default position ("off"), If I try to add a parameter after the function, it fails to process in the HTTP Shortcuts app. I know the photon and firmware are functioning properly becasue I am able to send the commands in the Photon Web CLI interface (0 for off and 1 for on) and the photon responds. I have a feeling it is a formatting problem where I am not entering the parameter for the function properly in the HTTP Shortcuts app. I have tried many combinations of formats for including the parameter (i.e. "1", 1, ;1,:1,(1),("1"), etc and can't seem to figure out how to send the needed parameter t the function in the firmware on the Photon.
Here is the command I entered and as I say, the photon is recognizing a command but always moves the servo to the default state in the program because there is no parameter being sent. (I removed my device ID from the command line below for obvious reasons)
I also have my token information entered on the apps authentication setting.
"https://api.particle.io/v1/devices/(removed my devce ID#)/ledState"
Any help is appreciated
Beta Was this translation helpful? Give feedback.
All reactions