[Solved] Workflow press virtual button

#1

In the api -
curl -H ‘Content-Type: application/json’
-H ‘Accept: application/json’
-H ‘Authorization: Bearer YOUR_API_ACCESS_TOKEN’
-X POST
-d ‘{“key”:“575ed18f7ae143cd83dc4aa6-SJaEw_dV”,“payload”:{“some”:“data”}}’
https://api.losant.com/applications/APPLICATION_ID/flows/FLOW_ID/virtualButton

what is the “key” value reference?

#2

key is the identifier of the virtual button to press. If you look at the JSON that represents your workflow, you will see in the triggers array there are probably entries that look like the following:
{"type": "virtualButton", "key": "1234d9727d90650006ad06da-Byb558I8c", ... }. That key value is what tells the API what virtual button you are pressing.

#3

I do not see “key” tag …

Also, in the header - Authorization - YOUR-API-ACCESS-TOKEN - is it the APPLICATION API TOKEN to be used … Bearer …

#4

I was not talking about the Example Payload section that you screenshotted above - I was talking about the actual JSON that represents the workflow (i.e., the return of the GET workflow API call - https://docs.losant.com/rest-api/flow/#get). However, what you highlighted is correct - I did not remember that triggerId in the payload for a virtual button is the virtual button’s key - so yes, that is the correct key string that you have highlighted.

For your api token, you can read more about obtaining a token here - in your case, either a User or Application API Token will work.

#5

I get the following … although status code is 200

#6

You look to be making a POST request against app.losant.com - that is the front-end UI. You want to be making requests against api.losant.com (like in the original example you have in the forum post at the start of this thread).

#7

Thanks, was a type on my part. Works!!

#8

Great! Glad you figured it out!