WP-API / docs

The content for developer.wordpress.org/rest-api
https://developer.wordpress.org/rest-api
110 stars 620 forks source link

Rate limits for comments endpoint? #131

Closed jordanmaurice closed 2 years ago

jordanmaurice commented 2 years ago

Hi,

I'm working on an application to automate blog comments and responses. I've noticed an issue when attempting to post comments on a blog post. It seems there is a limit of 1 per 20 seconds? I don't have any documentation of this limit to refer to but it certainly seems to be happening.

I can add a comment normally, but then if I call with a different email/comment text/user_agent etc, it will give error: "400 Client Error: Bad Request for url: /wp-json/wp/v2/comments"

If I add a 20 second delay between the comment calls, it will no longer get that message, but it also grinds my application to a halt when working on a lot of blogs on the same site.

Can we get some documentation on what the rate limits are?

Do we have any options to adjust them on a site by site basis?

TimothyBJacobs commented 2 years ago

Hi @jordanmaurice,

Yes, though this functionality isn't specific to the REST API, but rather is part of all of WP.

You can see it in action in the wp_check_comment_flood function. For specific coding help with customizing that function, I'd reach out to the WordPress Support Forums or WordPress Stack Exchange.