0
tofunao1 2 weeks ago in Scrapy Cloud 0

I found a topic: https://support.scrapinghub.com/topics/708-api-for-periodic-jobs/

This topic introduced how to use api to add periodic jobs, use

curl -X POST -u APIKEY: "http://dash.scrapinghub.com/api/periodic_jobs?project=PROJECTID" -d '{"hour": "0", "minutes_shift": "0", "month": "*", "spiders": [{"priority": "2", "args": {}, "name": "SPIDER"}], "day": "*"}'

Last day I found there always returns some error: https://support.scrapinghub.com/topics/2479-api-for-periodic-jobs-cannot-be-used/

Now I found when I change this command by replace '"' by '\"', then it works, such as:

curl -X POST -u APIKEY: \"http://dash.scrapinghub.com/api/periodic_jobs?project=PROJECTID\" -d "{\"hour\": \"0\", \"minutes_shift\": \"0\", \"month\": \"*\", \"spiders\": [{\"priority\": \"2\", \"args\": {}, \"name\": \"SPIDER\"}], \"day\": \"*\"}"

So I successfully add the periodic jobs.

But when I need to set the 'day of month’, I modify the command.

curl -X POST -u APIKEY: \"http://dash.scrapinghub.com/api/periodic_jobs?project=PROJECTID\" -d "{\"hour\": \"0\", \"minutes_shift\": \"0\", \"month\": \"*\", \"spiders\": [{\"priority\": \"2\", \"args\": {}, \"name\": \"SPIDER\"}], \"day\": \"*\", \"dayofmonth\": \"7\"}"

But the result always return 'every day' in 'day of month'. The '7' in the picture is altered manually.

Is there any bug in the api code? How can I solve it?