Detecting when movement is finished is hard. There is no feedback from the firmware about that. What you could do from your plugin is send an M400 and a queue marker right after that then calls back your plugin once it gets sent, indicating that the blocking M400 has finished processing on the printer and movements are done.
But that is quite advanced stuff and not easy to pull off due to how the communication protocol available on printers is designed.
Hence again my question: what is your end goal? What is your plugin supposed to do? You are currently asking precise questions related to a specific possible solution for a part of a problem you are trying to solve via a plugin, what I'm unclear about is what exactly you are trying to implement in the first place. There might be better ways than sending commands and waiting for movement to finish, and there certainly are better ways directly on the plugin interface than on the REST API. But unless you tell us what exactly you are trying to accomplish (on a level of "I want to write a plugin that does X when Y happens", not "I need to query the REST API when movement finishes"), it's hard to give you advice on how best to accomplish that.