Function Engine API

Qinling Base URLs

All API calls through the rest of this document require authentication with the OpenStack Identity service. They also required a url that is extracted from the Identity token of type function-engine. This will be the root url that every call below will be added to build a full path.

Note that if using OpenStack Identity service API v2, url can be represented via adminURL, internalURL or publicURL in endpoint catalog. In Identity service API v3, url is represented with field interface including admin, internal and public.

For instance, if the url is http://my-qinling-url.org/qinling/v1 then the full API call for /functions is http://my-qinling-url.org/qinling/v1/functions.

Depending on the deployment the function engine url might be http or https, a custom port, a custom path, and include your project id. The only way to know the urls for your deployment is by using the service catalog. The containers service URL should never be hard coded in applications, even if they are only expected to work at a single site. It should always be discovered from the Identity token.

As such, for the rest of this document we will be using short hand where GET /functions really means GET {your_qinling_url}/functions.

API Versions

Show all enabled API versions

GET
/

List all API versions

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

No parameters needed

Response Example

{
  "versions": [
    {
      "status": "CURRENT",
      "id": "v1.0",
      "links": [
        {
          "href": "http://api-uat.ormuco.com:7070/v1",
          "target": "v1",
          "rel": "self"
        }
      ]
    }
  ]
}

Runtimes

Lists, creates, updates, shows details and deletes runtimes.

The runtime is programming language support. Each runtime is encapsulated in a container image which is used for creating the runtime container. Qinling communicates with the container by sending HTTP requests and runs user function inside.

POST
/v1/runtimes

Create a runtime

Create a runtime.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

body

string

Runtime name

image

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

is_public (Optional)

body

bool

Make the runtime public or not, if public then the runtime will be available for all the tenant. The runtime is public by default.

trusted (Optional)

body

bool

Define the runtime as trusted or not, depending the value Kubernetes will apply some annotations like io.kubernetes.cri-o.TrustedSandbox in the pod specification to choose the underlying container runtime. The runtime is trusted by default.

Request Example

{
  "name": "python3",
  "description": "Runtime Python3.7 ready for production.",
  "image": "openstackqinling/python3-runtime",
  "is_public:": true,
  "trusted": true
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Runtime name

image

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

is_public (Optional)

body

bool

Make the runtime public or not, if public then the runtime will be available for all the tenant. The runtime is public by default.

trusted (Optional)

body

bool

Define the runtime as trusted or not, depending the value Kubernetes will apply some annotations like io.kubernetes.cri-o.TrustedSandbox in the pod specification to choose the underlying container runtime. The runtime is trusted by default.

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "status": "creating",
  "created_at": "2019-06-06 15:33:23.178645",
  "description": "Runtime Python3.7 ready for production.",
  "image": "openstackqinling/python3-runtime",
  "updated_at": null,
  "is_public": true,
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "id": "b351d3b6-8ccb-4f5b-b70f-58c72298a2ac",
  "trusted": true,
  "name": "python3"
}
GET
/v1/runtimes

List runtimes

List runtimes.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Runtime name

image

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

is_public (Optional)

body

bool

Make the runtime public or not, if public then the runtime will be available for all the tenant. The runtime is public by default.

trusted (Optional)

body

bool

Define the runtime as trusted or not, depending the value Kubernetes will apply some annotations like io.kubernetes.cri-o.TrustedSandbox in the pod specification to choose the underlying container runtime. The runtime is trusted by default.

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "status": "available", 
    "description": "Runtime Python3.7 ready for production.", 
    "image": "openstackqinling/python3-runtime", 
    "updated_at": "2019-05-30 14:40:50", 
    "created_at": "2019-05-30 14:40:41", 
    "is_public": true, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
    "trusted": true, 
    "name": "python3"
  }, 
  {
    "status": "available", 
    "description": "Runtime Python2.7 ready for production.", 
    "image": "openstackqinling/python2-runtime", 
    "updated_at": "2019-06-03 19:01:37", 
    "created_at": "2019-06-03 19:00:33", 
    "is_public": true, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "c4682a12-1a82-424d-b299-9b238fb6b694", 
    "trusted": true, 
    "name": "python2.7"
  }, 
  {
    "status": "available", 
    "description": "Runtime Node.js 8.10 ready for production.", 
    "image": "openstackqinling/nodejs-runtime", 
    "updated_at": "2019-06-03 19:30:31", 
    "created_at": "2019-06-03 19:30:06", 
    "is_public": true, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "d3780197-d3a8-4961-8228-354ac7592e48", 
    "trusted": true, 
    "name": "nodejs8.10"
  }
]
GET
/v1/runtimes/{runtime_id}

Show a runtime

Show a runtime.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

runtime_id

path

uuid

ID for the runtime

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Runtime name

image

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

is_public (Optional)

body

bool

Make the runtime public or not, if public then the runtime will be available for all the tenant. The runtime is public by default.

trusted (Optional)

body

bool

Define the runtime as trusted or not, depending the value Kubernetes will apply some annotations like io.kubernetes.cri-o.TrustedSandbox in the pod specification to choose the underlying container runtime. The runtime is trusted by default.

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "status": "available", 
  "description": "Runtime Python3.7 ready for production.", 
  "image": "openstackqinling/python3-runtime", 
  "updated_at": "2019-05-30 14:40:50", 
  "created_at": "2019-05-30 14:40:41", 
  "is_public": true, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
  "trusted": true, 
  "name": "python3"
}
GET
/v1/runtimes/{runtime_id}/pool

Show a runtime pool

Show a runtime pool.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

runtime_id

body

uuid

ID for the runtime

Response Parameters

Name

In

Type

Description

name

body

uuid

ID for the resource

capacity (Optional)

body

string

Number of workers available and currently used

Response Example

{
  "capacity": {
    "available": 3, 
    "total": 3
  }, 
  "name": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d"
}
PUT
/v1/runtimes/{runtime_id}

Update a runtime

Update a runtime.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

runtime_id

path

uuid

ID for the runtime

name (Optional)

body

string

Runtime name

image (Optional)

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

Request Example

{
  "name": "python3",
  "description": "Runtime Python3.7 ready for production.",
  "image": "openstackqinling/python3-runtime"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Runtime name

image

body

string

Docker image used to build the runtime, e.g. “openstackqinling/python3-runtime”

description (Optional)

body

string

Description for the runtime

is_public (Optional)

body

bool

Make the runtime public or not, if public then the runtime will be available for all the tenant. The runtime is public by default.

trusted (Optional)

body

bool

Define the runtime as trusted or not, depending the value Kubernetes will apply some annotations like io.kubernetes.cri-o.TrustedSandbox in the pod specification to choose the underlying container runtime. The runtime is trusted by default.

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "status": "available", 
  "description": "Runtime Python3.7 ready for production.", 
  "image": "openstackqinling/python3-runtime", 
  "updated_at": "2019-05-30 14:40:50", 
  "created_at": "2019-06-06 16:40:31", 
  "is_public": true, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
  "trusted": true, 
  "name": "python3"
}
DELETE
/v1/runtimes/{runtime_id}

Delete a runtime

Delete a runtime.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

runtime_id

path

uuid

ID for the runtime

Response Parameters

None

Response Example

Request to delete runtime 63f8f51d-7270-4545-abdd-f767ef8b1882 has been accepted.

Functions

Lists, creates, shows details for, downloads, detaches, updates, scales and deletes functions.

Function contains the source code that will be executed into the runtime. The source code langage within the function should match the runtime.

POST
/v1/functions

Create a function

Create a function.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id

body

uuid

Runtime ID used by the function

code

body

JSON

Source code type, e.g. “package”, “swift”, “image

entry

body

string

Function entry point, e.g. “hello_world.main

Not required if the source is “image

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

timeout (Optional)

body

integer

Timeout in second before the execution fails

package (Optional)

body

string

Package to upload, e.g. “package=@./hello_world.zip

Required only if ‘"code": {"source": "package"}

Request Example

Package

{
  "code": {
    "source": "package"
  },
  "description": "Hello World function from local package archive",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}
curl -X POST http://127.0.0.1:7070/v1/functions \
  -H "X-Auth-Token: gAAAAAB..." \
  -F name=hello_world \
  -F runtime_id=cbd9e85f-a1b2-4120-a2c7-57c90809ce7d \
  -F code='{"source": "package"}' \
  -F entry=hello_world.main \
  -F cpu=200 \
  -F memory=33000000 \
  -F description="Hello World function based on a package" \
  -F timeout=15 \
  -F package=@/home/dev/hello_world.zip

Swift

{
  "code": {
    "source": "swift",
    "swift": {
      "object": "hello_world.py",
      "container": "functions"
    }
  },
  "description": "Hello World function from Swift",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Image

{
  "code": {
    "source": "image",
    "image": "docker-registry/hello-world"
  },
  "description": "Hello World from Docker image",
  "memory_size": 33554432,
  "timeout": 15,
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id

body

uuid

Runtime ID used by the function

code

body

JSON

Source code type, e.g. “package”, “swift”, “image

entry

body

string

Function entry point, e.g. “hello_world.main

Not required if the source is “image

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

timeout (Optional)

body

integer

Timeout in second before the execution fails

package (Optional)

body

string

Package to upload, e.g. “package=@./hello_world.zip

Required only if ‘"code": {"source": "package"}

latest_version (Optional)

body

integer

Latest version created based on this function

count

body

integer

Total of time the function has been executed

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

Package

{
  "count": 0,
  "code": {
    "source": "package",
    "md5sum": "e439d00bab001d7ad7d1e0e451567699"
  },
  "description": "Hello World function from local package archive",
  "created_at": "2019-06-10 01:15:02.108208",
  "updated_at": null,
  "latest_version": 0,
  "id": "00f3b8ef-e794-4897-8a34-fa6a489d4ede",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Swift

{
  "count": 0,
  "code": {
    "source": "swift",
    "swift": {
      "object": "hello_world.py",
      "container": "functions"
    }
  },
  "description": "Hello World function from Swift",
  "created_at": "2019-06-10 01:43:53.909146",
  "updated_at": null,
  "latest_version": 0,
  "id": "1127cb1a-938e-4262-b22f-d88f182624f6",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Image

{
  "count": 0,
  "code": {
    "source": "image",
    "image": "docker-registry/hello-world"
  },
  "description": "Hello World from Docker image",
  "created_at": "2019-06-10 01:51:29.515424",
  "updated_at": null,
  "latest_version": 0,
  "id": "28de9573-2397-4fa1-b627-60124395d1ff",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": null,
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}
GET
/v1/functions

List functions

List functions.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id

body

uuid

Runtime ID used by the function

code

body

JSON

Source code type, e.g. “package”, “swift”, “image

count

body

integer

Total of time the function has been executed

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

entry

body

string

Function entry point, e.g. “hello_world.main

Not required if the source is “image

timeout (Optional)

body

integer

Timeout in second before the execution fails

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "count": 7, 
    "code": "{\"source\": \"package\", \"md5sum\": \"648926b8a9705d3bd77cefdeca46a254\"}", 
    "description": "Function Hello World :)", 
    "created_at": "2019-06-06 18:59:02", 
    "timeout": 10, 
    "updated_at": null, 
    "cpu": 250, 
    "memory_size": 134217728, 
    "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
    "entry": "hello_world.main", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "22f62e09-e361-4481-b2da-22e3a4ed9a43", 
    "name": "hello_world"
  }, 
  {
    "count": 0, 
    "code": "{\"source\": \"package\", \"md5sum\": \"e0309c12d355352cc92b5433bf293210\"}", 
    "description": "Function Goodbye World :(", 
    "created_at": "2019-06-06 19:04:30", 
    "timeout": 5, 
    "updated_at": "2019-06-06 19:04:30", 
    "cpu": 100, 
    "memory_size": 33554432, 
    "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
    "entry": "goodbye_world.main", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "2324a256-a249-4cec-968b-6ca7f99d805b", 
    "name": "goodbye_world"
  }
]
GET
/v1/functions/{function_id}

Show a function

Show a function.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id

body

uuid

Runtime ID used by the function

code

body

JSON

Source code type, e.g. “package”, “swift”, “image

count

body

integer

Total of time the function has been executed

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

entry

body

string

Function entry point, e.g. “hello_world.main

Not required if the source is “image

timeout (Optional)

body

integer

Timeout in second before the execution fails

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "count": 7, 
  "code": "{\"source\": \"package\", \"md5sum\": \"648926b8a9705d3bd77cefdeca46a254\"}", 
  "description": "Function Hello World :)", 
  "created_at": "2019-06-06 18:59:02", 
  "timeout": 10, 
  "updated_at": null, 
  "cpu": 250, 
  "memory_size": 134217728, 
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d", 
  "entry": "hello_world.main", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "22f62e09-e361-4481-b2da-22e3a4ed9a43", 
  "name": "hello_world"
} 
PUT
/v1/functions/{function_id}

Update a function

Update a function.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

name (Optional)

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id (Optional)

body

uuid

Runtime ID used by the function

code (Optional)

body

JSON

Source code type, e.g. “package”, “swift”, “image

Package function can’t have this value updated.

entry (Optional)

body

string

Function entry point, e.g. “hello_world.main

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

timeout (Optional)

body

integer

Timeout in second before the execution fails

package (Optional)

body

string

Package to upload, e.g. “package=@./hello_world.zip

Required only if ‘"code": {"source": "package"}

count

body

integer

Total of time the function has been executed

Request Example

Package

{
  "description": "Hello World function from local package archive",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}
curl -X PUT http://127.0.0.1:7070/v1/functions/{function_id} \
  -H "X-Auth-Token: gAAAAAB..." \
  -F name=hello_world \
  -F runtime_id=cbd9e85f-a1b2-4120-a2c7-57c90809ce7d \
  -F entry=hello_world.main \
  -F cpu=200 \
  -F memory=33000000 \
  -F description="Hello World function based on a package" \
  -F timeout=15 \
  -F package=@/home/dev/hello_world.zip

Swift

{
  "code": {
    "source": "swift",
    "swift": {
      "object": "hello_world.py",
      "container": "functions"
    }
  },
  "description": "Hello World function from Swift",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Image

It is not possible to update an image function.

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Function name

description (Optional)

body

string

Description for the function

runtime_id

body

uuid

Runtime ID used by the function

code

body

JSON

Source code type, e.g. “package”, “swift”, “image

count

body

integer

Total of time the function has been executed

cpu (Optional)

body

integer

Max CPU usage during the execution

memory (Optional)

body

integer

Max memory usage during the execution

entry

body

string

Function entry point, e.g. “hello_world.main

Not required if the source is “image

timeout (Optional)

body

integer

Timeout in second before the execution fails

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

Package

{
  "count": 0,
  "code": {
    "source": "package",
    "md5sum": "e439d00bab001d7ad7d1e0e451567699"
  },
  "description": "Hello World function from local package archive",
  "created_at": "2019-06-10 01:15:02.108208",
  "updated_at": "2019-06-10 01:15:02.115438",
  "latest_version": 0,
  "id": "00f3b8ef-e794-4897-8a34-fa6a489d4ede",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Swift

{
  "count": 0,
  "code": {
    "source": "swift",
    "swift": {
      "object": "hello_world.py",
      "container": "functions"
    }
  },
  "description": "Hello World function from Swift",
  "created_at": "2019-06-10 01:28:38",
  "updated_at": "2019-06-10 02:22:27.663257",
  "latest_version": 0,
  "id": "ecdf3b0c-ac37-4ba8-a02c-5d60cf86cc8b",
  "memory_size": 33554432,
  "timeout": 15,
  "entry": "hello_world.main",
  "project_id": "5eeb5916ae4b43699f06ea422e581b83",
  "cpu": 200,
  "runtime_id": "cbd9e85f-a1b2-4120-a2c7-57c90809ce7d",
  "name": "hello_world"
}

Image

None

GET
/v1/functions/{function_id}?download=true

Download a function

Download a function.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

Response Parameters

None

Response Example

Code package downloaded to /root/f8e7357f-af4a-4448-87d8-6fed4c7db5b5.zip
POST
/v1/functions/{function_id}/detach

Detach a function from a worker

Detach a function from a worker.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

Response Parameters

None

Response Example

Request to detach function f8e7357f-af4a-4448-87d8-6fed4c7db5b5 has been accepted.
POST
/v1/functions/{function_id}/scale_up

Scale up a function

Scale up a function.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

count (Optional)

body

integer

Number of workers to scale up a function, default is 1

Response Parameters

None

Response Example

Request to scale up function 3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46 has been accepted.
POST
/v1/functions/{function_id}/scale_down

Scale down a function

Scale down a function.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

count (Optional)

body

integer

Number of workers to scale down a function, default is 1

Response Parameters

None

Response Example

Request to scale down function 3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46 has been accepted.
DELETE
/v1/functions/{function_id}

Delete a function

Delete a function.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

Response Parameters

None

Response Example

Request to delete function ff64180b-d41b-420e-9846-ee706c1548b0 has been accepted.

Executions

Lists, creates, shows details for, and deletes function executions.

An execution runs the function and stores the return of the function. The execution gets the returns and the prints.

POST
/v1/executions

Create an execution

Create an execution.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_alias (Optional)

body

string

Alias name of the function (if an alias has been created)

input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

description (Optional)

body

string

Description for the execution

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

sync (Optional)

body

bool

Execution is sync or async, default is true

Request Example

{
  "description": "The world should know Foo!", 
  "sync": true, 
  "function_version": 0, 
  "input": "{\"name\": \"foo\"}", 
  "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46"
}
{
  "description": "Execution of a function based on an alias",
  "sync": true,
  "input": "{\"name\": \"foo\"}",
  "function_alias": "hq-production-function"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

description (Optional)

body

string

Description for the execution

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

sync (Optional)

body

bool

Execution is sync or async, default is true

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "status": "success", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "description": "The world should know Foo!", 
  "updated_at": "2019-06-06 23:13:37", 
  "created_at": "2019-06-06 23:13:37", 
  "sync": true, 
  "function_version": 0, 
  "result": "{\"duration\": 0.044, \"output\": \"Hello, bar\"}", 
  "input": "{\"name\": \"foo\"}", 
  "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", 
  "id": "62033613-6f02-4a6d-b569-7ba7fd18f8f7"
}
GET
/v1/executions

List executions

List executions.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

description (Optional)

body

string

Description for the execution

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

sync (Optional)

body

bool

Execution is sync or async, default is true

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "status": "success", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": null, 
    "created_at": "2019-06-06 21:05:39", 
    "sync": true, 
    "function_version": 0, 
    "result": "{\"duration\": 0.074, \"output\": \"Hello, World\"}", 
    "input": null, 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "updated_at": "2019-06-06 21:05:41", 
    "id": "7dbb2ebc-9096-4e8e-9ded-0af8cd6cef60"
  }, 
  {
    "status": "success", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": "The world should know Foo!", 
    "created_at": "2019-06-06 23:15:30", 
    "sync": true, 
    "function_version": 0, 
    "result": "{\"duration\": 0.032, \"output\": \"Hello, bar\"}", 
    "input": "{\"name\": \"bar\"}", 
    "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", 
    "updated_at": "2019-06-06 23:15:30", 
    "id": "347bb366-95c9-49ab-8179-424c7b707124"
  }
]
GET
/v1/executions?{filter}={function_id}

List executions by filters

List executions by filters..

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

filter

path

string

Execution filter, e.g. “function_id, function_version, etc…”

function_id

path

uuid

ID for the function

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

description (Optional)

body

string

Description for the execution

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

sync (Optional)

body

bool

Execution is sync or async, default is true

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "status": "success", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": null, 
    "created_at": "2019-06-06 21:05:39", 
    "sync": true, 
    "function_version": 0, 
    "result": "{\"duration\": 0.074, \"output\": \"Hello, World\"}", 
    "input": null, 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "updated_at": "2019-06-06 21:05:41", 
    "id": "7dbb2ebc-9096-4e8e-9ded-0af8cd6cef60"
  }, 
  {
    "status": "success", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": null, 
    "created_at": "2019-06-06 23:50:41", 
    "sync": true, 
    "function_version": 0, 
    "result": "{\"duration\": 0.183, \"output\": \"Hello, bar\"}", 
    "input": "{\"name\": \"bar\"}", 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "updated_at": "2019-06-06 23:50:42", 
    "id": "9b6d0e80-7c4b-49d1-bf11-f16999433337"
  }
]
GET
/v1/executions/{execution_id}

Show an execution

Show an execution.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

execution_id

path

uuid

ID for the execution

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

description (Optional)

body

string

Description for the execution

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

sync (Optional)

body

bool

Execution is sync or async, default is true

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "status": "success", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "description": "The world should know Foo!", 
  "created_at": "2019-06-06 23:15:30", 
  "sync": true, 
  "function_version": 0, 
  "result": "{\"duration\": 0.032, \"output\": \"Hello, bar\"}", 
  "input": "{\"name\": \"bar\"}", 
  "function_id": "3e0e5bf8-ee7a-4fc8-9641-d1cbd9c60f46", 
  "updated_at": "2019-06-06 23:15:30", 
  "id": "347bb366-95c9-49ab-8179-424c7b707124"
}
GET
/v1/executions/{execution_id}/log

Show an execution log

Show an execution log.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

execution_id

path

uuid

ID for the execution

Response Parameters

None

Response Example

Start execution: 347bb366-95c9-49ab-8179-424c7b707124
Hello, World!
Finished execution: 347bb366-95c9-49ab-8179-424c7b707124
DELETE
/v1/executions/{execution_id}

Delete an execution

Delete an execution.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

execution_id

path

uuid

ID for the execution

Response Parameters

None

Response Example

Request to delete execution 9b6d0e80-7c4b-49d1-bf11-f16999433337 has been accepted.

Versions

Lists, creates, detaches, shows details and deletes versions.

Function versions are like git commits, they’re snapshots of your project history. Each version has a number that serves as its ID, starting with 1 and incrementing up, and never reused. The code for a published version of a function is immutable (i.e. cannot be changed). So, a version number corresponds to a specific set of function code with certainty.

POST
/v1/functions/{function_id}/versions

Create a version

Create a version.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

description (Optional)

body

string

Description for the version

Request Example

{
  "description": "This version is ready for production"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the version

function_id

body

uuid

ID for the function

count (Optional)

body

integer

Total of time the version has been executed

version_number (Optional)

body

integer

Version of the function

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "count": 0, 
  "version_number": 1, 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "This version is ready for production", 
  "created_at": "2019-06-07 01:23:16.278205", 
  "updated_at": null, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc"
}
GET
/v1/functions/{function_id}/versions

List versions

List versions.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the version

function_id

body

uuid

ID for the function

count (Optional)

body

integer

Total of time the version has been executed

version_number (Optional)

body

integer

Version of the function

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "count": 0, 
    "version_number": 1, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": "This version is ready for production", 
    "created_at": "2019-06-07 01:23:16", 
    "updated_at": null, 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc"
  }, 
  {
    "count": 0, 
    "version_number": 2, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "description": "This version has not been tested yet", 
    "created_at": "2019-06-07 01:34:10", 
    "updated_at": null, 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "id": "9490f863-020b-4746-8f30-9324cff31678"
  }
]
GET
/v1/functions/{function_id}/versions/{version_number}

Show a version

Show a version.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

version_number

path

integer

Version number

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the version

function_id

body

uuid

ID for the function

count (Optional)

body

integer

Total of time the version has been executed

version_number (Optional)

body

integer

Version of the function

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "count": 0, 
  "version_number": 1, 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "This version is ready for production", 
  "created_at": "2019-06-07 01:23:16", 
  "updated_at": null, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "45ebdcbf-6e2f-46c9-bd58-7f6ae01ecfcc"
}
POST
/v1/functions/{function_id}/versions/{version_number}/detach

Detach a version

Detach a version.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

version_number

path

integer

Version number

Response Parameters

None

Response Example

Request to detach function f8e7357f-af4a-4448-87d8-6fed4c7db5b5(version 1) has been accepted.
DELETE
/v1/functions/{function_id}/versions/{version_number}

Delete a version

Delete a version.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

path

uuid

ID for the function

version_number

path

integer

Version number

Response Parameters

None

Response Example

None

Aliases

Lists, creates, updates, shows details and deletes aliases.

Function aliases are like pointers to the specific function versions. By using aliases, you can access the specific version of a function an alias is pointing to without having to know the specific version the alias is pointing to.

POST
/v1/aliases

Create an alias

Create ana alias.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

body

uuid

ID for the function

version

body

integer

Version of the function to point the alias

description (Optional)

body

string

Description for the alias

Request Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "name": "hw-v2", 
  "function_version": 2, 
  "description": "Hello World, version 2"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the alias

description (Optional)

body

string

Description for the alias

function_id

body

uuid

ID for the function

version_number

body

integer

Version of the function to point the alias

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "name": "hw-v2", 
  "created_at": "2019-06-07 02:07:06.572982", 
  "updated_at": null, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "function_version": 2, 
  "description": "Hello World, version 2"
}
GET
/v1/aliases

List aliases

List aliases.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the alias

description (Optional)

body

string

Description for the alias

function_id

body

uuid

ID for the function

version_number

body

integer

Version of the function to point the alias

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "name": "hw-v2", 
    "created_at": "2019-06-07 02:07:06", 
    "updated_at": null, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "function_version": 2, 
    "description": "Hello World, version 2"
  }, 
  {
    "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", 
    "name": "hq-v1", 
    "created_at": "2019-06-07 02:15:16", 
    "updated_at": null, 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "function_version": 37, 
    "description": "Hello Qinling, version 37"
  }
]
GET
/v1/aliases/{name}

Show an alias

Show an alias.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

path

string

Name of the alias

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the alias

description (Optional)

body

string

Description for the alias

function_id

body

uuid

ID for the function

version_number

body

integer

Version of the function to point the alias

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "name": "hw-v2", 
  "created_at": "2019-06-07 02:07:06", 
  "updated_at": null, 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "function_version": 2, 
  "description": "Hello World, version 2"
}
PUT
/v1/aliases/{name}

Update an alias

Update an alias.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

path

string

Name of the alias

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the alias

description (Optional)

body

string

Description for the alias

function_id

body

uuid

ID for the function

version_number

body

integer

Version of the function to point the alias

project_id

body

uuid

ID for the project that owns the resource

status

body

enum

Status of the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Request Example

{
  "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", 
  "name": "hq-v1", 
  "function_version": 38, 
  "description": "Hello Qinling, version 38"
}

Response Example

{
  "function_id": "ab003f7a-402a-4a2e-8f00-2f848bde800d", 
  "name": "hq-v1", 
  "created_at": "2019-06-07 02:15:16", 
  "updated_at": "2019-06-07 02:32:14.097418", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "function_version": 38, 
  "description": "Hello Qinling, version 38"
}
DELETE
/v1/aliases/{name}

Delete an alias

Delete an alias.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

path

string

Name of the alias

Response Parameters

None

Response Example

Request to delete function_alias hw-v2 has been accepted.

Webhooks

Lists, creates, updates, shows details and deletes webhooks.

Webhooks are a low-effort way to invoke the functions. They do not require a bot user or authentication to use.

POST
/v1/webhooks

Create a webhook

Create a webhook.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_alias (Optional)

body

string

Alias name of the function (if an alias has been created)

function_version (Optional)

body

integer

Version of the function

description (Optional)

body

string

Description for the webhook

Request Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5",
  "description": "Webhook triggered by Jenkins",
  "function_version": 2
}
{
  "function_alias": "hq-production-function",
  "description": "Webhook based on function alias triggered by Jenkins"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the webhook

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

version_number (Optional)

body

integer

Version of the function

webhook_url

body

string

Webhook URL

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "Webhook triggered by Jenkins", 
  "created_at": "2019-06-07 14:53:22.989283", 
  "updated_at": null, 
  "function_version": 2, 
  "webhook_url": "http://127.0.0.1:7070/v1/webhooks/2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89/invoke", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89"
}
GET
/v1/webhooks

List webhooks

List webhooks.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the webhook

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

version_number (Optional)

body

integer

Version of the function

webhook_url

body

string

Webhook URL

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "function_id": "e47ca07c-b0cc-4501-901f-1c2e3df46724", 
    "description": "Webhook Hello World", 
    "created_at": "2019-06-07 02:48:16", 
    "updated_at": null, 
    "function_version": 0, 
    "webhook_url": "http://127.0.0.1:7070/v1/webhooks/726779f2-227f-43af-a891-4de85e8dadd5/invoke", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "726779f2-227f-43af-a891-4de85e8dadd5"
  }, 
  {
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "description": "Webhook triggered by Jenkins", 
    "created_at": "2019-06-07 14:52:19", 
    "updated_at": null, 
    "function_version": 2, 
    "webhook_url": "http://127.0.0.1:7070/v1/webhooks/e3f34707-8fea-4d36-b558-e39b00b99105/invoke", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "id": "e3f34707-8fea-4d36-b558-e39b00b99105"
  }
]
GET
/v1/webhooks/{webhook_id}

Show a webhook

Show a webhook.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

webhook_id

path

uuid

ID for the webhook

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the webhook

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

version_number (Optional)

body

integer

Version of the function

webhook_url

body

string

Webhook URL

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "Webhook triggered by Jenkins", 
  "created_at": "2019-06-07 14:52:19", 
  "updated_at": null, 
  "function_version": 2, 
  "webhook_url": "http://127.0.0.1:7070/v1/webhooks/e3f34707-8fea-4d36-b558-e39b00b99105/invoke", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "e3f34707-8fea-4d36-b558-e39b00b99105"
}
PUT
/v1/webhooks/{webhook_id}

Update a webhook

Update a webhook.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

webhook_id

path

uuid

ID for the webhook

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_alias (Optional)

body

string

Alias name of the function (if an alias has been created)

function_version (Optional)

body

integer

Version of the function

description (Optional)

body

string

Description for the webhook

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

description (Optional)

body

string

Description for the webhook

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

version_number (Optional)

body

integer

Version of the function

webhook_url

body

string

Webhook URL

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Request Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "Webhook triggered by Gitlab", 
  "function_version": 2
}
{
  "description": "Webhook based on function alias triggered by Gitlab",
  "function_alias": "hq-staging-function"
}

Response Example

{
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "description": "Webhook triggered by Gitlab", 
  "created_at": "2019-06-07 14:53:22", 
  "updated_at": "2019-06-07 18:06:42", 
  "function_version": 2, 
  "webhook_url": "http://127.0.0.1:7070/v1/webhooks/2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89/invoke", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "id": "2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89"
}
DELETE
/v1/webhooks/{webhook_id}

Delete a webhook

Delete a webhook.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

webhook_id

path

uuid

ID for the webhook

Response Parameters

None

Response Example

Request to delete webhook 2aac6d93-c4d3-4fc6-9d3b-8852be0c8c89 has been accepted.

Jobs

Lists, creates, updates, shows details and deletes jobs.

Jobs allows to run periodically functions based on time period. Time period is based on cron syntax.

POST
/v1/jobs

Create a job

Create a job.

Response Codes

Success

Code

Reason

201 - Created

Resource was created and is ready to use.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

name

body

string

Name of the job

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_alias (Optional)

body

string

Alias name of the function (if an alias has been created)

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

function_input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

pattern

body

string

Cron pattern, e.g. “* * * * *” is equal to every minutes

count (Optional)

body

integer

Number of time the function should be executed, default is unlimited

Request Example

{
  "count": 5, 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "function_version": 2, 
  "function_input": "{\"name\": \"Foo\"}", 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5"
}
{
  "count": 5, 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "function_input": "{\"name\": \"Foo\"}", 
  "function_alias": "hq-production-function"
}

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the job

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

function_input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

pattern

body

string

Cron pattern, e.g. “* * * * *” is equal to every minutes

count (Optional)

body

integer

Number of time the function should be executed, default is unlimited

first_execution_time

body

string

First time the function will be executed

next_execution_time

body

string

Next time the function will be executed

status

body

enum

Status of the resource

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "count": 5, 
  "status": "running", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "created_at": "2019-06-07 19:11:08.375646", 
  "updated_at": null, 
  "function_version": 2, 
  "first_execution_time": "2019-06-07 19:12:00", 
  "function_input": "{\"name\": \"Foo\"}", 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "id": "dc7ef571-1f8d-4dc8-a659-fc86f80dd44c", 
  "next_execution_time": "2019-06-07 19:12:00"
}
GET
/v1/jobs

List jobs

List jobs.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the job

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

function_input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

pattern

body

string

Cron pattern, e.g. “* * * * *” is equal to every minutes

count (Optional)

body

integer

Number of time the function should be executed, default is unlimited

first_execution_time

body

string

First time the function will be executed

next_execution_time

body

string

Next time the function will be executed

status

body

enum

Status of the resource

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

[
  {
    "count": null, 
    "status": "running", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "name": "every-minute", 
    "pattern": "0 0 * * SUN", 
    "created_at": "2019-06-07 19:18:50", 
    "updated_at": "2019-06-07 19:29:59", 
    "id": "697546a1-090c-48de-8ecd-ef4cdb9da7a9", 
    "first_execution_time": "2019-06-07 19:19:00", 
    "function_input": null, 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "function_version": 2, 
    "next_execution_time": "2019-06-07 19:31:00"
  }, 
  {
    "count": 0, 
    "status": "done", 
    "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
    "name": "every-minute", 
    "pattern": "* * * * *", 
    "created_at": "2019-06-07 19:21:33", 
    "updated_at": "2019-06-07 19:25:59", 
    "id": "4e435c84-ab06-4ff5-8f05-b7ffe25c1224", 
    "first_execution_time": "2019-06-07 19:22:00", 
    "function_input": "{\"name\": \"Foo\"}", 
    "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
    "function_version": 0, 
    "next_execution_time": "2019-06-07 19:26:00"
  }
]
GET
/v1/jobs/{job_id}

Show a job

Show a job.

Response Codes

Success

Code

Reason

200 - OK

Request was successful.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

job_id

path

uuid

ID for the job

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the job

function_id

body

uuid

ID for the function, if an alias is used then function_id is not required

function_version (Optional)

body

integer

Version of the function to execute, default is 0. If an alias is used then function_version is not required

function_input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

pattern

body

string

Cron pattern, e.g. “* * * * *” is equal to every minutes

count (Optional)

body

integer

Number of time the function should be executed, default is unlimited

first_execution_time

body

string

First time the function will be executed

next_execution_time

body

string

Next time the function will be executed

status

body

enum

Status of the resource

project_id

body

uuid

ID for the project that owns the resource

created_at (Optional)

body

datestamp

Date / Time when resource was created

updated_at (Optional)

body

datestamp

Date / Time when resource last updated

Response Example

{
  "count": 0, 
  "status": "done", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "created_at": "2019-06-07 19:21:33", 
  "updated_at": "2019-06-07 19:25:59", 
  "id": "4e435c84-ab06-4ff5-8f05-b7ffe25c1224", 
  "first_execution_time": "2019-06-07 19:22:00", 
  "function_input": "{\"name\": \"Foo\"}", 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "function_version": 0, 
  "next_execution_time": "2019-06-07 19:26:00"
}
PUT
/v1/jobs/{job_id}

Update a job

Update a job.

Response Codes

Success

Code

Reason

202 - Accepted

Request was accepted for processing, but the processing has not been completed. A ‘location’ header is included in the response which contains a link to check the progress of the request.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

job_id

path

uuid

ID for the job

Response Parameters

Name

In

Type

Description

id

body

uuid

ID for the resource

name

body

string

Name of the job

function_input (Optional)

body

JSON

Input data to pass to the function, e.g. {"name": "foo"}

pattern (Optional)

body

string

Cron pattern, e.g. “* * * * *” is equal to every minutes

next_execution_time

body

string

Next time the function will be executed, e.g. “2019-06-07 22:41:00

status (Optional)

body

string

Status of the job, e.g. “paused, running, canceled, done

Request Example

{
  "status": "paused", 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "function_input": "{\"name\": \"Foo\"}", 
  "next_execution_time": "2019-06-07 22:41:00"
}

Response Example

{
  "count": null, 
  "status": "paused", 
  "project_id": "5eeb5916ae4b43699f06ea422e581b83", 
  "name": "every-minute", 
  "pattern": "* * * * *", 
  "created_at": "2019-06-07 19:18:50", 
  "updated_at": "2019-06-07 19:41:20.108254", 
  "function_version": 2, 
  "first_execution_time": "2019-06-07 19:19:00", 
  "function_input": "{\"name\": \"Foo\"}", 
  "function_id": "f8e7357f-af4a-4448-87d8-6fed4c7db5b5", 
  "id": "697546a1-090c-48de-8ecd-ef4cdb9da7a9", 
  "next_execution_time": "2019-06-07 22:41:00"
}
DELETE
/v1/jobs/{job_id}

Delete a job

Delete a job.

Response Codes

Success

Code

Reason

204 - No Content

The server has fulfilled the request by deleting the resource.

Error

Code

Reason

400 - Bad Request

Some content in the request was invalid.

401 - Unauthorized

User must authenticate before making a request.

403 - Forbidden

Policy does not allow current user to do this operation.

Request

Name

In

Type

Description

x-auth-token (Optional)

header

string

Token used to identify the user from Keystone

job_id

path

uuid

ID for the job

Response Parameters

None

Response Example

Request to delete job 697546a1-090c-48de-8ecd-ef4cdb9da7a9 has been accepted.