Using the Discourse API ruby gem to post a topic as a specific user

I’ve been running it in a development environment, but just tested it in a production env. The logs don’t show for me either, but I’m able to replicate the same behavior is both env’s.

If you create a post as an admin or moderator and you specify the category as a string it does its best to guess the correct category and will work, but a regular user will hit this line

causing a 404 if you don’t specify the category as an id.

This works

topic = {
  category: 8,
  skip_validations: true,
  auto_track: false,
  title: random_string,
  api_username: "ifvhonqlmxesadwpktc",
  raw: random_string
}
new_topic = client.create_topic(topic)

This causes a 404:

topic = {
  category: "Category",
  skip_validations: true,
  auto_track: false,
  title: random_string,
  api_username: "ifvhonqlmxesadwpktc",
  raw: random_string
}
new_topic = client.create_topic(topic)