DO Ideas 2

Provide an API for querying the progress of an event

When performing functions such as power on or power off, the response is a status and an event id. However the state of the droplet hasn't yet fully transitioned and indeed if I query the droplet state it still shows as in the original state. It would be nice to be able to query the progress of and event both for display purposes and to know when can sensibly re-query the droplet state.

  • Austin
  • Sep 11 2018
  • Shipped
  • Attach files
  • Moisey Uretsky commented
    September 11, 2018 19:04

    That's correct, some actions are trackable the entire way through the progress, other actions have some heavy lifting occur or done rapidly in which case it can go high quickly.

  • Austin commented
    September 11, 2018 19:04

    Thanks, I presumed as much regarding null. There seems to be a bug in the percentage field in that it goes from null to 3 and repeats at 3 over and over until it flips to 100. I tried this creating a snapshot as well as rebooting, they both do the same, the snapshot produced a 3% percentage result about 20 or so times before jumping to 100%.

  • Moisey Uretsky commented
    September 11, 2018 19:04

    null means it hasn't started processing yet and events will run to 100 or until "action_status" is not nil - at which point it indicates either success or an error was encountered.

  • Austin commented
    September 11, 2018 19:04

    Thanks.

    What does percentage null mean? Does that mean its not started yet?

    I am seeing percentage go null, 3, 3, 3, 3, 100 for a power on event for a droplet that is already powered on.

  • Moisey Uretsky commented
    September 11, 2018 19:04

    Hey Austin,

    Wow thanks for pointing this out, this was an oversight in our docs, there actually is an event API query which does exactly this.

    Its:
    https://api.digitalocean.com/events/[:event_id]

    You will see "percentage" and also "action_status"

    Action_status is nil until the event completes, then it is set to "done" which means everything went ok, or any other string would indicate an error.

    The percentage also get's updated, so you can query against that to see how an event is progressing.

    We will update our API documentation to include this!

    Thanks