Hello Losant Team!
I currently have an API of type POST that receives approximately 17 requests per minute. I need to save the values that come to me and create devices according to certain conditions. My question is: is it possible to put all those requests in one package and then run a separate workflow to process that data? That is, out of 17 requests, do only one and then run another workflow.
Excuse me if I’m asking something crazy but maybe you know something I don’t.
Thanks and happy new year!
You may be able to save each request as a Data Table row and, in a workflow running on a Timer Trigger or using a Resource Job, do the batch-processing on a regular interval. However, data table cells have a maximum length of 768 characters, and you would almost certainly exceed that limit in some of your requests, leading to errors and lost data. So you would instead want to do some of your data processing per-request and save that result in the table, so that you control the length of each property.
Another option would be to use workflow storage to hold the request bodies or the post-processed data and use a Timer Trigger in that same workflow to do your batch processing. In this scenario, you would need to use an Application Workflow triggering off your endpoint request (as opposed to the usual Experience Workflow) since Timer Triggers are not available in Experience Workflows.
In each of these scenarios, you would still need to issue a reply to each of your API requests instead of holding it open until the workflow ran, letting your users know that the request was received and that it is being processed.
If you can tell me more about the use case, I may be able to offer a better alternative.