Particle HTTP Authorization and POST Data

I am trying to figure out how to build out a seemingly simple app to communicate with my Particle Argon (I am learning new IoT things on my own).

I am able to authenticate and make the LED turn on and off using CURL using both inline and HTTP authorization. However, I am unable to get the App Inventor to connect successfully with a confirmation.

At the simplest proof-of-concept level, I want to be able to tap a button, the LED goes to that state, and I get the confirmation into a label. Literally a GUI version of what CURL does.

Once that works, then I want to add a functionality using GPS coords. But i'm at the baby steps phase right now, and confused because all my googlefu is taking me to threads with old information or information that looks right, but I don't so much as get an error returned or anything.

¡¿Puedes ayudarme?!

Remove web1.get block and try again

No change. My objective/hope is that whatever the function returns is what will show up in the ReturnVal label, hence the name of the label. It comes back in CURL as a JSON response, so to me that should be doable?

Based on this curl command (taken from your image above):

curl https://api.particle.io/v1/devices/<deviceCode>/text -H "Authorization: Bearer <access_token>" -d "args=2"

try these blocks:

Using MakeADictionary did not work, but I went back and double checked some things and found an error in which device was being called (I have a whole classroom worth of Argons that were donated, so I'm learning as I go to teach others). The LED does blink now when I click either button, but the function return (1 or 2 as currently written) does not populate into Label 1.

I also changed the function from int to char, in case it was some kind of handling issue from the return call to the label. No difference, it just returned the ASCII number for the character as I expected to CURL but no change to app GUI.

OK, I have made alot of progress, but I am more confused now than when I started coding tonight's session because my location feedback loop is working, but the timestamp feedback loop (the original one) is not. The variables are posting to the Console as they should be, so I don't see that being the issue. I'm plum confused.

Background: I'm over 13 university laboratories in 2 buildings, plus I travel into at least 4 other buildings on campus for other tasks (like co-teaching and collaborating). The goal is to have a digital display on my office door, for which I can use this app I'm building to customize what it says in addition to automatically parsing which building (or at least what area of campus) I am in (or if my GPS is off-campus, it says so).

I'm just trying to babystep my way through learning how to do this.

Screenshot 2025-02-24 at 10.47.23 PM
Screenshot 2025-02-24 at 10.49.47 PM


Do you have a link to the Particle code library and code samples?

I can't figure out why the sketch does all its work in the Setup section instead of the loop section.

That's just how Particles work. They are a cloud API tool, loop() as we know it from arduino and similar is a cloud API listener handled by Particle.function().

Anywho, I was able to get everything working how I wanted tonight. It was alot of reading and going "Why does X do Y?" over and over until I finally connected a bunch of dots.