Is there a REST API call for Azure Mobile Service's Scheduler Run Once?

…衆ロ難τιáo~ 提交于 2019-12-24 11:23:47

问题


Using the Azure portal, I can click the Run Once button on a Scheduler job to execute it. Is that functionality available via a REST call from my app? The scenario is that periodically a job is run to check for changes in data. The first time the app starts up, I would like to execute that job once as not to have to wait for the scheduled time.

What is the call to kick off a scheduled job? Would I have to duplicate code in both the scheduler job and custom API and then call the custom API from my code?


回答1:


You can execute a scheduler job by sending a POST request to /jobs/<jobName> (no request body required). But you need to pass the master key of your mobile service (in the x-zumo-master HTTP header), so you should only do that from a location that is not visible to your users - you don't want anyone getting a hold of your master key, as this would open up your service for all kinds of attacks.



来源:https://stackoverflow.com/questions/27861700/is-there-a-rest-api-call-for-azure-mobile-services-scheduler-run-once

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!