API Gateway sequence

Sequencing actions

This example builds on the “Hello World” API Gateway example by combining multiple actions in a sequence to create a complex result and making this sequence available through the API Gateway.

It shows how to:

  • create a sequence that chains multiple actions.
  • export the sequence via the gateway.

Manifest file

Example: “Hello world” sequence with API

    version: 1.0
    license: Apache-2.0
        function: src/hello.js
        function: src/hello_goodday.js
        actions: hello_basic, hello_goodday
        web: true
            hello_world: GET

There are two key changes to this file:

  • we now have two actions define and neither of them is web available.
  • we have a new sequence that is web available.
  • the apis block now refers to the sequence rather than the action.


You can actually deploy the “API Gateway sequence” manifest from the incubator-openwhisk-wskdeploy project directory if you have downloaded it from GitHub:

$ wskdeploy -m docs/examples/manifest_hello_world_apigateway_sequence.yaml


Check the full URL of your API first:

$ wsk api list

This will return some information on the API, including the full URL, which should end with hello/world. It can then be invoked:

$ curl <url>


The invocation should return a JSON response that includes this result:

    "greeting": "Hello, undefined from undefined, have a good day!"

The output parameter ‘greeting’ contains “undefined” values for the ‘name’ and ‘place’ input parameters as they were not provided in the manifest or the HTTP call. You can provide them as query parameters:

$ curl <url>?name=World&place=Earth


This example is very basic but it shows the power of OpenWhisk in creating complex processes by chaining together simple actions and making the resulting sequence available via the API Gateway. This allows you to build small modular actions rather than big bulky ones. And because OpenWhisk allows actions to be written with different programming languages, you can mix and match, for example chaining a combination of JavaScript and Python actions in the same sequence.

Source code

The source code for the manifest and JavaScript files can be found here:


For convenience, the Packages and Actions grammar can be found here: