Aller au contenu
#0133
Curl

A cron-scheduled API poll that survives restarts

You want to pull the same JSON endpoint every morning at 9am weekdays: competitor pricing, exchange rates, the daily exports drop. Traditional path: a cron entry on a server, a script that runs curl, error handling, retries, somewhere to write the response, a way to recover if the server reboots mid-week.

You POST to /api/v1/curl/schedule with cron: "0 0 9 * * MON-FRI" and the request payload: url, method, headers, retry count. That's the setup. The schedule persists across restarts. Each run lands as a job; each response saves into the curl service's downloads/ storage, indexed by job, by date, and by domain.

You never wrote the loop, the retry logic, or the storage path.

The schedule and the request are the same object.