APIs

The API entity schema is used to define an OpenWhisk API within a manifest.

Fields

Grammar

<apiName>:
    <basePath>:
        <relativePath>:
            <actionName>:
                method: <get | delete | put | post | ...>
                response: <http | json | text | html>

Example

packages:
  hello_world_package:
    version: 1.0
    license: Apache-2.0
    actions:
      hello_world:
        function: src/hello.js
        web-export: true
    apis:
      hello-world:
        hello:
          world:
            hello_world:
              method: GET
              response: json
      goodbye-world:
        hello:
          world:
            hello_world:
              method: DELETE
              response: json

Requirements

  • The API name MUST be less than or equal to 256 characters.
  • The API basePath value MUST start with a / character.
  • The APi relativePath value MUST start with a / character.
  • The API entity schema includes all required fields declared above.
  • Only web actions, actions having web-export set to true, can be used as an API endpoint's action.
    • If needed, the action will be automatically converted to a web action during deployment.
  • A valid API entity MUST have one or more valid endpoints defined.

Notes