Calling POST on /posts.json returns null


(Nick) #1

I’m trying to create a new post using the API (Discourse 2.2.0). In the settings, approve post count is set to 3 and approve unless trust level is set to 1: basic user.

When posting valid data, the response is an HTTP 200, but the response is null.

If approve post count and approve unless trust level are default values, the API returns JSON for the response.

We use the response to map a discourse topic/post to a record within our system. Naturally, we can’t make this linkage if we don’t receive back an id in the response.

Is this what the API is supposed to do? Why not send back a response and a status letting the API’s client know that the post/topic is under review?


(Sam Saffron) #2

Are you 100% sure this is returning nothing?

When I posted this post I got:

And we are explicit about returning stuff here:

There may be some edge case though if your post hits the queue, but I am pretty sure it should return a payload.

Can you try: How to reverse engineer the Discourse API