Which validations can be bypassed and how when using the API to create topics/posts

Which validations can you bypass and how? I’m trying to use API to post and am hitting things like:

  • Entropy too low
  • Topic too short
  • Body too similar

The problem is, it is hard to know what other checks might be caught and so I just stop when I hit one, abort and run again.

1 Like

If you’re importing more than a few posts from an existing database then you should use a migration script.

There’s a skip_validations parameter you can pass in Ruby, but I don’t know if you can pass it with the API.

But also, do you really want to create a bunch of short posts that have very few different characters and are just like other posts? There are site settings for those that you can change if you search site settings for those words (entropy, minimum post length, min title similar length or allow duplicate titles)

4 Likes

Yes, that should work :+1: (WP-Discourse uses it, for example)

2 Likes

I think there is a bug in the skip validations.

When I use skip validations to create a Topic, this works and it is possible for user to create a topic in a category even if normally he would have no rights to do so.

However, when trying to reply to that same topic, the validation check is not skipped and this post create fails.

1 Like

Can you elaborate on what post validations you are referring to exactly? What errors do you get?

Are you sure about that? My understanding is that skip_validations does what it says it does in the options section that’s at the bottom of post_creator.rb:

It’s primarily used to ignore the constraints that are added through site settings like:

  • min post length
  • min body entropy
  • min topic title length

I think it’s also used to ignore posting rate limits.

I didn’t think it allowed users to create topics in categories that they don’t have permission to post in.

2 Likes