I want to run a script once a day

So as the title says,

I want to run a script once a day that pulls in current data from a multipage API, joins it together then uploads it as, say, ‘data.JSON’ to my github, triggering a redeployment. How would one do this?

this isn’t specifically a Cloudflare issue, but I am hoping some of the bright minds on here might be able to help a beginner out with this problem.

I am building a site that at the moment gets its data from a Wordpress/Gravity Forms api. The api is limited to a max of 100 results per page, and eventually there will be 6-7 pages (600-700+ results). I need ALL the results to build the data table and charts that the site needs. The front end is being built in react.

So currently the way it is working is that each visit by a user triggers these 6-7 api calls. Then the app builds the front end from the received data. However the data will rarely be changing, so a much better option would be to have a script that once a day makes the calls to the api, builds a file with the returned data, uploads that to the repo the site is being built from and then have my site/repo reference that static file.

Thing is I am still a bit new to this, so whilst I am sure this is possible, I am not really sure how to go about this. I see Cloudflare has things called ‘workers’. Could they be configured to do something like this? If someone here could give me some pointers on where to start that would be great.

Alternatively if someone could build the script for me and get it all set up I would be happy to pay them a fair price for their time.

Thanks…

Hi,

You could start by looking at the Cloudflare Workers Tutorials and overall documentation; that will give you an idea of what you can accomplish, and perhaps how.

https://developers.cloudflare.com/workers/tutorials

You should also edit this post to change the category to Developers > Workers, to get the attention of the right crowd.

I’d also suggest you join the Cloudflare Workers Discord channel, where many developers gather to exchange ideas. Linked to under Community here.

3 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.