147

For a project I'm working on, it'd be nice to be able to retract flags through the API.

We allow people to retract flags from the web. Could this functionality be extended to the API? It could work such that you receive a 'Retract Flags' option on calls to /questions/{id}/flags/options, then pass it to /questions/{id}/flags/add to retract flags.

Thoughts? I don't think this is open to abuse, and it'd help some automation projects (and folks using the apps)

8
  • 17
    This would be really useful, because it would allow people who run automation apps to redact false positive flags via the API, without having to manually log in to their sock and redact the flag manually. Commented Dec 15, 2016 at 6:29
  • 2
    Bounty on a feature request seems a bit like bribery ;) Commented Dec 17, 2016 at 7:36
  • 8
    @faintsignal Rep doesn't matter too much to the SE devs.... they can just edit the database :P Commented Dec 18, 2016 at 10:00
  • 9
    A related request would be allowing us to get the status of a flag: meta.stackexchange.com/questions/245416/…
    – Andy
    Commented Dec 29, 2016 at 2:05
  • 4
    Accessing the /add verb to retract a flag makes me twitchy. Checking the API docs, votes use the /undo verb. For flags we could use /undo as well, or use /retract. If I understand correctly, we wouldn't need to access /options first to receive a "retract flags" option either -- we just request retraction, and either there is a flag and it gets retracted, or there isn't and nothing happens. Commented Jan 3, 2018 at 14:46
  • 5
    @doppelgreener And I too, but ultimately the request is aimed at ease of implementation. Adding it to /options and /add would immediately show the retract option in the mobile apps without client-side work.
    – Undo
    Commented Jan 3, 2018 at 15:08
  • 1
    @SonictheMaskedWerehog I don't see how adding this feature would resolve the issue you've linked. There's an SE-internal route which allows flags to be retracted. That's available if you have the browser cookies and fkey. This is a request to permit applications/scripts with a SE API Write Token to be able to retract flags, just like they can raise flags. The issue you've linked to is mostly a UI issue, which isn't impacted by this issue.
    – Makyen
    Commented Aug 9, 2020 at 0:04

1 Answer 1

21

We have added the option to retract flags via API. When getting flag_options via flags/options now you will see a new property named is_retraction. When it is set to true you can pass that flag_option.id to /flags/add to retract it. At the moment we can't provide feedback on the state of the flag, so if you attempt to retract the same flag twice, or to retract a flag that has already been resolved, the operation will fail and you will receive a WriteFailed error.

You must log in to answer this question.

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