Skip to content
Apache OpenWhisk Go client API library
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
tools/travis Update Travis to use ASF-Release.cfg. (#92) May 31, 2018
vendor replace godep with govendor (#113) Jan 30, 2019
whisk Added extra columns to activation records summary rows (#116) Feb 22, 2019
wski18n Format source code Jan 28, 2018
.travis.yml Fix markdown files with a typo. in the Hash license header. (#83) May 10, 2018
DISCLAIMER.txt Add the DISCLAIMER file for Apache incubator project (#93) Jun 6, 2018
LICENSE.txt Change the copyright back to the template (#98) Aug 3, 2018
NOTICE.txt update end year to 2019 (#117) Mar 4, 2019 replace godep with govendor (#113) Jan 30, 2019

Openwhisk Client Go

License Build Status

This project openwhisk-client-go is a Go client library to access Openwhisk API.


You need to install the following package in order to run this Go client library:

Make sure you select the package that fits your local environment, and set the GOPATH environment variable.


After you download the source code either from the Github or the release page of OpenWhisk, you should have a directory named incubator-openwhisk-client-go to host all the source code. Please copy this root directory incubator-openwhisk-client-go into the directory $GOPATH/src/


Open a terminal, and run the following commands to run the unit tests:

$ cd $GOPATH/src/
$ govendor sync
$ go test -v ./... -tags=unit

You should see all the unit tests passed. If not, please log an issue for us.


This Go client library is used to access the OpenWhisk API, so please make sure you have an OpenWhisk service running somewhere available for you to run this library.

We use a configuration file called wskprop to specify all the parameters necessary for this Go client library to access the OpenWhisk services. Make sure you create or edit the file ~/.wskprops, and add the mandatory parameters APIHOST, APIVERSION, NAMESPACE and AUTH.

The parameter APIHOST is the OpenWhisk API hostname (for example,,, and so on). The parameter APIVERSION is the version of OpenWhisk API to be used to access the OpenWhisk resources. The parameter NAMESPACE is the OpenWhisk namespace used to specify the OpenWhisk resources about to be accessed. The parameter AUTH is the authentication key used to authenticate the incoming requests to the OpenWhisk services.

For more information regarding the REST API of OpenWhisk, please refer to OpenWhisk REST API.


import ""

Construct a new whisk client, then use various services to access different parts of the whisk api. For example to get the hello action:

client, _ := whisk.NewClient(http.DefaultClient, nil)
action, resp, err := client.Actions.List("hello")

Some API methods have optional parameters that can be passed. For example, to list the first 30 actions, after the 30th action:

client, _ := whisk.NewClient(http.DefaultClient, nil)

options := &whisk.ActionListOptions{
  Limit: 30,
  Skip: 30,

actions, resp, err := client.Actions.List(options)

By default, this Go client library is automatically configured by the configuration file wskprop. The parameters of APIHOST, APIVERSION, NAMESPACE and AUTH will be used to access the OpenWhisk services.

In addition, it can also be configured by passing in a *whisk.Config object as the second argument to whisk.New( ... ). For example:

config := &whisk.Config{
  Host: "",
  Version: "v1"
  Namespace: "_",
  AuthKey: "aaaaa-bbbbb-ccccc-ddddd-eeeee"
client, err := whisk.Newclient(http.DefaultClient, config)


You need to have an OpenWhisk service accessible, to run the following example.

Please be advised that all the Go files you are about to create should be under the directory of $GOPATH or its subdirectories. For example, create the Go file named openwhisk_client_go.go under a directory called $GOPATH/src/example to try the following code.

import (


func main() {
  client, err := whisk.NewClient(http.DefaultClient, nil)
  if err != nil {

  options := &whisk.ActionListOptions{
    Limit: 30,
    Skip: 30,

  actions, resp, err := client.Actions.List(options)
  if err != nil {

  fmt.Println("Returned with status: ", resp.Status)
  fmt.Println("Returned actions: \n%+v", actions)


Then build it with the go tool:

$ cd $GOPATH/src/example
$ go build

The command above will build an executable named client in the directory alongside your source code. Execute it to see the the result:

$ ./openwhisk_client_go

If the openWhisk service is available and your configuration is correct, you should receive the status and the actions with the above example.


Apache OpenWhisk Client Go is an effort undergoing incubation at The Apache Software Foundation (ASF), sponsored by the Apache Incubator. Incubation is required of all newly accepted projects until a further review indicates that the infrastructure, communications, and decision making process have stabilized in a manner consistent with other successful ASF projects. While incubation status is not necessarily a reflection of the completeness or stability of the code, it does indicate that the project has yet to be fully endorsed by the ASF.

You can’t perform that action at this time.