Replies accepted on the front are being rejected by the api


(Aarskin) #1

TL;DR

  • What does Discourse require from it’s replies for them to be accepted from the API?

  • Can I post the same message as the same user to different topics from the API?

Context

I’m developing a simple application that listens for emojis added to a slack message. If the emoji additions follow a simple pattern, it triggers a series of api calls to an internal Discourse site.

For a while it worked perfectly, but recently replies are being (as far as I can tell) sporadically rejected for being an Unprocessable Entity. I noticed this when I was tagging the same message as a comment and solution, only the first reply would show up, but this seemed kinda normal - why accept the same exact reply from the same user within milliseconds of each other?

The Weird Part

I’ve written some logic that I would think would make any particular Unprocessable Entity processable

replyResponse = PostReply(topicId, reply);
if(!replyResponse.IsSuccessStatusCode)
{
    string editNote = "\n\nThis comment was initially rejected. Please consider expanding or deleting it.";
    string lengthenedReply = reply + editNote;
    PostReply(topicId, lengthenedReply);
    Vert.Aesthetics.Display("Screw it, no reply: " + lengthenedReply);
}`

What’s weird is that I’ve seen these lengthened replies rejected even when it’s the only reply on that topic that says what it says - and has plenty of distinct words in it. What more does Discourse want?

I’m testing my functionality with smoke tests currently and just manually tagging messages with emoji. So i end up with what looks like this:

The topic and at a least 1 reply are always there behind the link. It’s right about 50/50 if two make it though. Why is this happening? Am I breaking some api rule I’m unaware of by posting as the same - or unidentified - user?


(Sam Saffron) #2

Are you making exact duplicate posts? Are you going over the rate limits?

When creating stuff via the API as admin you ca skip_valudations maybe that is what you are after


(Aarskin) #3

Yes, but across posts.

What are the rate limits?


(Sam Saffron) #4

yeah well that is why its being rejected checkout: