Trigger object

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
nickmansrob
 
Posts: 3
Joined: Sat Jan 02, 2021 2:13 pm

Trigger object

Post by nickmansrob »

Hi everyone,

I'm trying to figure out which object to pass in the body of this request: https://io.adafruit.com/api/docs/#replace-action. The docs mention the "trigger" object but I can't find it's definition, so I don't know which values and keys I need to pass in i.e. a Postman request.

Anyone an idea? Thanks!
Rob Nickmans

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: Trigger object

Post by jwcooper »

We renamed triggers to 'actions' recently, but this isn't a commonly used api endpoint, and it expects the older trigger object yet.

Here are the valid values you can pass:

Code: Select all

:feed_id, :operator, :value, :action, :to_feed_id, :action_feed_id, :action_value, :body_template, :subject_template
Formatting would be:

trigger: { feed_id: n, operator: n, ...}

We typically suggest using the UI to manage actions, as the API for this isn't as well documented as it should be yet (the demand has never really been there for making it easier to use).

What is your use case where you're looking to automate this?

User avatar
nickmansrob
 
Posts: 3
Joined: Sat Jan 02, 2021 2:13 pm

Re: Trigger object

Post by nickmansrob »

Hi

Thanks for supplying me with the details. I'm trying to control the Actions tab of Adafruit IO with an Android app. That way, I can change the values of an action right in the app.

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: Trigger object

Post by jwcooper »

Glad to help.

Also, a great way to see exactly how to handle the API calls is make an create/update/delete to an action in the IO UI, and take a look at the network call in inspector. The IO UI is using the API for everything as well. You can see how the request is built, etc.

User avatar
jwcooper
 
Posts: 1004
Joined: Tue May 01, 2012 9:08 pm

Re: Trigger object

Post by jwcooper »

Also, just a heads-up...we're actively working on actions right now and the API calls will likely subtly change. API V2 for the Actions/Triggers isn't really set in stone yet.

Last week we deployed changes to the email action output type that allows custom subject and body templating similar to webhooks.

In the pipeline is action limiters, to control how often they are allowed to fire.

User avatar
nickmansrob
 
Posts: 3
Joined: Sat Jan 02, 2021 2:13 pm

Re: Trigger object

Post by nickmansrob »

Thank you a lot! I managed it to work, I can implement this now in my app and update it accordingly when the API changes. Thanks for your help and have a great day!

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”