Is there a way to access a {{PARTICLE_NOTES}} field?
I want to extract the notes from the the particle dashboard for a specific electron and populate that information through an integration. Basically to store notes concerning a specific electron into an external database. I would think this Notes field would be accessible, but I haven’t found an API for it yet?
the examples you sent me to show a lot of CLI syntax. My program is written in C. I am looking for a way to access this information from within a C program.
hey, I do not want to be a pain, but C as in the firmware of a Particle device or C as in a linux computer?
Please write as much detail as you can so me (and others) can get a better idea of what you are trying to do.
thanks!
The way I would go about an Electron hitting an HTTPS API would be to use the Particle Webhooks.
So, from the Electron you would Particle.publish() an event, then parse the response to get the notes field.
The event would trigger a particle webhook that is hitting the particle API endpoints described in post 2.
sorry, this is as far as I can get you today. I have no experience yet in parsing a webhook response
If you fix it and think you can help others in the future, please post your fix here (and so I learn too).
Thank you,
Gustavo.
Hi @vsthose I think I might be able to help. I recently made a similar webhook myself that accessed the same endpoint on the API.
In the console, what you should really be looking at is:
Response
The HTTP response received from the webhook url
In the JSON at the end there should be a "notes" field.
In order to have the device receive the notes string directly, you can add the following response template to the webhook:
{{{notes}}}
Also, just to make sure your webhook is working properly, could you paste the raw JSON here? (Redacting any sensitive info of course.) To do this, you can edit the webhook, click Custom Template, and then copy the raw JSON.
Edit:
Posting as much of your electron code as possible would also help to find a solution quicker.
// Establish proper Time Stamp
Time.setFormat(TIME_FORMAT_ISO8601_FULL);
Serial1.begin(9600);
Serial4.begin(9600);
// New Function to send a command back to PLC.
Particle.function("Command",issueCommand);
Particle.variable("locationInfo", locationInfo);
Particle.subscribe("particle/device/ip", handler);
Particle.publish("particle/device/ip");
// grab Location information
Particle.subscribe("particle/device/name", saveName);
Particle.publish("particle/device/name");
Particle.subscribe("particle/device/notes", saveNote);
Particle.publish("particle/device/notes");
Particle.publish("Note", deviceNote, PRIVATE);
Particle.subscribe("PLC_data", handler);
locator.withSubscribe(locationCallback).withLocateOnce();
// Just added.
Particle.connect();
delay(1000);
}
I think a big part of my problem is I am getting "null" when I try to subscribe to the notes field in the same manner as I subscribe to the name field.
I can see "null" being pushed to the Webhook as the data component of the "Note" Event I created.
I have successfully created a different Webhook that processes serial data and merges it with the PARTICLE_NAME field