0

The documentation for the edit question method (/questions/{id}/edit) is somewhat vague.
Are all of the parameters required?

For example, if the only field I want to change in the question is tags, do I still have to provide title and body?

(It seems like I may have to, but that seems incredibly inefficient so I assume that I'm misunderstanding something?)


Edit:

  • When providing the body should it be with or without markdown, and safe or unsafe?

  • Should I replace Escape Codes like \n/\r/\t with ASCII characters (10/13/9) before sending the body back with the edit? What about HTML Entity codes

An example of an issue is this:

"...End Sub \r\n\r\n\r\nShould..."

...becomes this:

"...End Sub \\r\\n\\r\\n\\r\\nShould..." 

...after passing through my process; I've tried several variations.


Related Questions:


I would have assumed there was a way to indicate "no changes to this field", with a zero length string or a specific symbol, to avoid issues like this; having to deal with markdown conversion and such, when all I want to do is add or remove a tag.

  • @brock ...so it would be body , not body_markdown, that would need to be sent back with the edit, correct? Would special consideration be needed for Unicode symbols such as Chinese or Emojis? – ashleedawg Jun 28 '18 at 2:29
  • body takes markdown or the allowed HTML that posts can have. As for Chinese or Emojis, you'll have to test that. My guess is that if it's not UTF8, then it gets stripped or mangled. – Brock Adams Jun 28 '18 at 2:57
  • @BrockAdams I'm mangling some questions pretty good on my own (ie., revisions here and here) Having trouble figuring it out. I switched to body_markdown as you suggested, but both safe or unsafe "mess up the body" – ashleedawg Jun 28 '18 at 6:02
  • The whitespace problem is a completely separate question (and may have been addressed before, here or on MSE). – Brock Adams Jun 28 '18 at 6:03
  • Just to make sure we're on the same page, would the whitespace in this question also cause the type of issue you're referring to? ...'cuz this is an example of one on which I'm struggling to add a tag – ashleedawg Jun 28 '18 at 6:20
  • Yes​‌​‌​‌​‌​‌​‌. – Brock Adams Jun 28 '18 at 6:23
  • Actually, this question is a duplicate of this old query -- which never got any love. – Brock Adams Jun 28 '18 at 6:41
  • @Brock - Yeah thank you; I saw that one. Seems to be a lot of loveless API questions... I understand there aren't a ton of people using it, and granted I'm not an expert (using the API client side with VBA etc) ...so, maybe there's something I'm not grasping here, but it seems like you're saying nobody can use the API to edit questions without encountering this issue? Hard to believe. – ashleedawg Jun 28 '18 at 8:34
  • I said no such thing. Merely that I have not tested any solutions to your second question, nor can I find/remember where it was discussed before. I know for a fact that others have used the API to edit questions without the whitespace problem (but they did have other issues). And there should be a nice no_change flag, but there isn't. – Brock Adams Jun 28 '18 at 8:44
1

Yes, you must provide all three of: tags, title, and body -- even if they haven't changed.

Otherwise you will get error messages like:

"error_id": 400, "error_message": "tags", "error_name": "bad_parameter"

Or

"error_id": 400, "error_message": "title", "error_name": "bad_parameter"

Or

"error_id": 400, "error_message": "body", "error_name": "bad_parameter"

(Emphasis added)


Note that I just edited the question, above, via the API.

You must log in to answer this question.

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