Some cloud apis are considered to be ‘long running’, which means you wont get the result right away. Rather the result is stored and you can retrieve it later. There is an api for doing all that, so you can of course use that. However, many of the Node API libraries have got that complication covered by returning a promise to the result. This article will use the Video Intelligence API as an example.

Starting your long running operation

Lets reduce it to this, where request contains the parameters for the video intelligence annotation request


The Api makes it super simple to submit the request and get a promise to the final result
  • The api returns an array, the first element of which is the operation object
  • You can extract a promise from the operation object – again its an array, and the first element of it is the result of the long running operation when resolved.


And now you can extract the operation results from that long running promise resolution. Again, it’s an array, but you only want the first element.
More Google Cloud Platform topics below.