0

When we invoke an action through the CLI, we get the activation ID as the result. But when we generate the API for the action in Bluemix and try to invoke the API, I receive only the result of the action. How can we get the activation ID of the action after the invocation? Should we be able to get the response later by using the activation ID?

Akhil Reddy
  • 23
  • 1
  • 10
  • It sounds like you are asking about the OpenWhisk UI, not the CLI, which the answers below seem to focus on - is that right? – Raymond Camden May 26 '17 at 13:16

2 Answers2

1

An action, in its execution context has its activation id available: it's available in the environment variables as __OW_ACTIVATION_ID.

You can return this value in your response - if you're using a web action or API gateway and have the ability to send custom headers as a result you can use that as a mechanism to return the id. Or simply return the id itself.

Given an activation id, you can use it later with the activation API to retrieve the result.

It sounds like you want a non-blocking activation as opposed to request/response style. For that if you aren't using a webaction or API gateway, the default invoke mechanism is non blocking which return to you the activation id.

Here is a reference to the API https://github.com/apache/incubator-openwhisk/blob/master/docs/rest_api.md

user6062970
  • 831
  • 4
  • 5
1

If you are invoking from the CLI using the following, you should get back the activation ID and the result:

wsk action invoke --blocking the-action-name

You can get a list of activations ordered from the most recent to the oldest:

wsk activation list

There´s a very nice documentation with a bunch of details and using diff languages --> https://console.ng.bluemix.net/docs/openwhisk/openwhisk_actions.html#openwhisk_actions_polling

Fergara
  • 929
  • 8
  • 15