When creating new topics via the API, I am suddenly getting this error. It’s been working fine all morning. I am sure it’s not related to rate limiting because that is not the error message. Also, I have a 2 second sleep between API commands.
I can create posts just fine, but when I try to create a post as a new topic with the following parameters it fails:
api_key = $AUTH_APIKEY api_username = $AUTH_USERNAME title = "my topic title" raw = "my post text" category = 0 created_at = "1/27/2017 15:41"
Also, this only just started happening. I have been creating Topics and Posts all morning with my API script.
I’m really not sure. You might need to go to /logs and see if you can see a better error message with a little bit more detail. It could not like the title or the body of the post or any number of things, but I think those wouldn’t throw a 500. It could be overloading your db and server especially if you have sidekiq running as well.
Is there reason why you are creating a posts/topics every 2 seconds via the api? Maybe it would be better to write an import script and run it on the server with sidekiq off.
ArgumentError (argument out of range) /var/www/discourse/vendor/bundle/ruby/2.4.0/gems/activesupport-5.1.4/lib/active_support/values/time_zone.rb:528:ininitialize’`
I don’t think the rest of the log details are relevant, and it is quite lengthy.
Regarding the 2-second timing… I am trying to avoid a hard rate limit, even though I have set my limits to 0 seconds under Admin. Using the API is super convenient, but it is getting painful. I have a flat file with all of the data to import. My users are already staged and I am importing 2,000+ topics and 14,000+ posts. I think I need to just follow the docs for writing an import script.
FWIW, I am using PowerShell and monitoring the API output as I go. I have discovered all of the limitations like min/max char. limits, etc. So it has been helpful. But again, it seems to me an import script would be faster.
Any suggestions on where to start? Another user suggested starting with the PhpBB3 script and going from there. I would like to avoid setting up a local server, etc. as @pfaffman and others suggest. My environment is still pre-production so I am not concerned users seeing it as it goes along.
I went back and looked at the API docs – the /post endpoint wants the post date in the format like
yyyy-MM-dd HH:mm
Once I updated my script to use that format, everything started working again. The mystery is why similar dates worked up until now. Anyway, thanks for your help Blake.