Issue in post creation API

I am working on this forum which is powered by Discourse. After the moderators provided me with an api key and username, I found a bug in the POST /posts.json API endpoint.

As mentioned here this endpoint accepts a topic_id which should be an integer. But when I make a request using the topic_id and raw parameters something like

{
  "topic_id": 17470,
  "raw": "Test post."
}

I get the following error.

'You are not permitted to view the requested resource. The API username or key is invalid.'

But I am successfully able to create the post after changing the request data such that topic_id is a string.

  "topic_id": "17470",
  "raw": "Test post."
}

Something does not sound right, from the perspective of an HTTP POST there is no difference between 100 and "100".

Can you provide with a consistent repro here?

1 Like