Save API Workflow ID

Hey pals, I’ve looked upon documentation to know how to save the unique ID of each API scheduled but i haven’t found a way to retrieve it. I need to do that in order to control which APIs I need to reset when launching new functionalities to my users.

Thank you.

in my workflow when you schedule an API workflow i create a workflow thing and save the API workflow which includes the workflow id i then use this for example when cancelling a workflow and the like

2 Likes

Can’t believe it was so simply direct. Thanks guys.

1 Like

I would agree that the documentation on this could be a bit better.

I might suggest you nudge the Bubble team to make this a bit clearer.

Aside: until recently, Schedule API Workflow actions did not always return an ID. This was a bug that was fixed some time ago.

But, regarding the OP’s somewhat cryptic post: @contato, please know that there are only two things that can be done/known based on that value. They are these:

  1. If you retrieve this ID (and save it for future use), you can CANCEL that API Workflow by using that unique ID. (As @NigelG points out, this might be used to allow a user to manually cancel a previously-scheduled like a future social media post or similar.)

  2. You can use this returned value as a timing signal that the API Workflow has been scheduled and that downstream actions in your workflow may now proceed. It’s a way of saying… please await completion of this task’s scheduling before doing something that might interfere with that scheduling (there’s really only 1 such thing – leaving the page by reloading the current page or navigating AWAY from the current page).

(To explain in more detail: Step X schedules an API Workflow. We want Step X+1 to wait for that scheduling to be complete before proceeding with further steps (X+2, etc.). You can set Step X+1 to execute “Only when…” the result of Step X is not empty. (The point being that Bubble can only evaluate this condition once Step X is done. Note that Step X will NEVER actually return empty. [There was a time that it would – this was a bug and now that bug is fixed.] So this state of the results of step X having a value or not… Is simply a timing signal. The scheduling will NEVER fail. We are just saying – please wait until Step X is done before running step X+1 and further steps (the further steps part here is imaginary, AFAICT there’s no need to assess the value of this ID unless you intend to cancel the workflow (see above) or if you intend to now leave the page, which will always be the LAST action in the workflow).

So, the reasons we might do this are VERY limited – we might be leaving or reloading the page, for example, and just need to make sure that some value is on its way to being safely written to the database before we do that…)

There are no other applications as far as I know (or that I can imagine). So, the OP’s comment about needing “to know that in order to control which APIs… etc.” makes no sense to me.

But we have answered the original question, as posed to us by @contato.

1 Like

Ah yes - gotcha! Thanks for that @NigelG… (I guess it becomes obvious now that my own use of Schedule API Workflow is usually confined to scheduling immediate actions that must be run server-side, rather than the user-directed case!)

1 Like

This is my scenario Keith. Some actions are scheduled one some days weeks in advance and some user may then change the date (from mondays to fridays, for example) in which case i need to cancel prior workflows and reset them to the new date.

Thanks all for the answer, it works fine.

1 Like

I want to add, that it’s not entirely clear how to retrieve the ID itself from the post above. I had to set the value to the result of the step from the Schedule the API step to get the API ID.

1 Like

In my case, the “Result of step X…” is not an option. What could I be doing wrong? I can schedule the recurring event, I can see its ID in the scheduler, but in my workflow I can’t see the “Result of step…” in order to grab the ID and save it to the database.

Any help will be really appreciated.

Thanks!

You have to make sure the field type is set to text