2

I made a call to update the question tags using API - https://api.stackexchange.com/docs/edit-question however the body formatting changes when I edit the tags with the same body received (with HTML tags) from Stack Exchange - https://api.stackexchange.com/docs/questions-by-ids.

Is there something I can do to not change the formatting of the body while editing the tags in a question?

0

2 Answers 2

2

You can't just edit the tags via the API, you have to set the body as well. For that, you need the Markdown (the body_markdown field in the filter) instead of the HTML:

enter image description here

1
  • Thanks! Yes, I was able to verify the API is working after adding the body_markdown.
    – SO User
    Commented Nov 18, 2020 at 18:59
0

I'm answering my own question - when I was working on the POC using postman, starting with GetQuestionById call and taking the necessary response fields and created the edit question on postman, the formatting of the question changed even though I had not modified anything.

However, the API worked successfully when I made the same call from code. But it's good to use the body_markdown field along with a HtmlDecoder before sending the same data as form-url-encoded.

In C#

HttpUtility.HtmlDecode(stackOverflowQuestion["body_markdown"])

Using the above value as the body field in the edit question API was helpful.

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