Answer the question
In order to leave comments, you need to log in
How to notify about the status of a certain process through RestAPI?
I am making RestAPI. This RestAPI will have "long" functions, purely for example "launch of a nuclear missile", which is performed in stages
1) Opening the hatch of the mine 2) Launching the rocket 3) Passing the air defense circuit 4) Hitting the target.
It will be useful for the API user to know about these events, how to deliver this data to him?
Only one thought came to my mind:
1) After launching the "rocket", give some unique token.
2) In the system itself, bind all work completion statuses to this token.
3) The one who launched the process, if it is important for him to know the status, must continuously poll the status for this issued token. The
disadvantages of this option are the additional load on the server and client, are there any ways to do this more intelligently?
Upd.
Answer the question
In order to leave comments, you need to log in
Restrictions in this case are set not by the code and the framework used, but by REST rules. "Smarter" within the framework of these rules, you can not do.
You can write somewhere about the status of the program.
For example launched the program, put the status in a DB/file. When you need to read it. After completion, change the status.
This is if crutch.
Again, a lot depends on the framework, most of them have built-in events that can monitor all this, and so on.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question