1

I'm trying to to integrate the Stack Exchange API in my application. I'm trying the authentication but when I got the token and used it it gave a write_access issue. That issue was resolved when I added this post to my Stack App.

Now I'm trying to add a comment to a post with this API method. I've provided the client id and other required things. It seems the request is processed and I got the following response:

{
  "items": [
    {
      "owner": {
        "reputation": 1191,
        "user_id": 11560663,
        "user_type": "registered",
        "profile_image": "https://www.gravatar.com/avatar/a59d8b9589bd07f84b2eaab0300f8dee?s=128&d=identicon&r=PG&f=1",
        "display_name": "Trinetra-MSFT",
        "link": "https://stackoverflow.com/users/11560663/trinetra-msft"
      },
      "edited": false,
      "creation_date": 1592556596,
      "post_id": 61778786
    }
  ],
  "has_more": false,
  "quota_max": 10000,
  "quota_remaining": 9984
}

but no comment has been added. How come?

  • okay Thanks for your Quick support really appreciate it Man... – msftsofbot Jun 19 at 9:11
1

When using the API to add/edit posts or comments, you need to ensure the preview parameter is set to false, otherwise it's just a 'test' request which does nothing (but allows you to test if the response parsing on your side works correctly). Just like writing content on the site itself, the body needs to be in Markdown.

If you set preview to false, you'll get an extra comment_id in the response:

enter image description here

That edited is false here just means the comment has never been edited; it does not mean the request failed.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .