Skip to content

Commit 98f47d0

Browse files
authored
openwhisk: add rest api chapter (IBM-Cloud#1354)
1 parent 3f5c8a1 commit 98f47d0

File tree

3 files changed

+338
-62
lines changed

3 files changed

+338
-62
lines changed

openwhisk/openwhisk_reference.md

+1-61
Original file line numberDiff line numberDiff line change
@@ -405,68 +405,8 @@ You may include any compilation steps or dependencies by modifying the `Dockerfi
405405

406406
## REST API
407407
{: #openwhisk_ref_restapi}
408+
Information about the REST API can be found [here](openwhisk_rest_api.html)
408409

409-
All the capabilities in the system are available through a REST API. There are collection and entity endpoints for actions, triggers, rules, packages, activations, and namespaces.
410-
411-
These are the collection endpoints:
412-
413-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces`
414-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/actions`
415-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/triggers`
416-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/rules`
417-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/packages`
418-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/activations`
419-
420-
The `openwhisk.`<span class="keyword" data-hd-keyref="DomainName">DomainName</span>` is the OpenWhisk API hostname (for example, openwhisk.ng.bluemix.net, 172.17.0.1, and so on).
421-
422-
For the `{namespace}`, the character `_` can be used to specify the user's *default
423-
namespace* (that is, email address).
424-
425-
You can perform a GET request on the collection endpoints to fetch a list of entities in the collection.
426-
427-
There are entity endpoints for each type of entity:
428-
429-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}`
430-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/actions/[{packageName}/]{actionName}`
431-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/triggers/{triggerName}`
432-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/rules/{ruleName}`
433-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/packages/{packageName}`
434-
- `https://`openwhisk.<span class="keyword" data-hd-keyref="DomainName">DomainName</span>`/api/v1/namespaces/{namespace}/activations/{activationName}`
435-
436-
437-
The namespace and activation endpoints support only GET requests. The actions, triggers, rules, and packages endpoints support GET, PUT, and DELETE requests. The endpoints of actions, triggers, and rules also support POST requests, which are used to invoke actions and triggers and enable or disable rules. Refer to the [API reference](https://console.{DomainName}/apidocs/98) for details.
438-
439-
All APIs are protected with HTTP Basic authentication. The Basic authentication credentials are in the `AUTH` property in your `~/.wskprops` file, delimited by a colon. You can also retrieve these credentials in the [CLI configuration steps](./index.html#openwhisk_start_configure_cli).
440-
441-
The following is an example that uses the cURL command to get the list of all packages in the `whisk.system` namespace:
442-
443-
```
444-
curl -u USERNAME:PASSWORD https://openwhisk.ng.bluemix.net/api/v1/namespaces/whisk.system/packages
445-
```
446-
{: pre}
447-
```
448-
[
449-
{
450-
"name": "slack",
451-
"binding": false,
452-
"publish": true,
453-
"annotations": [
454-
{
455-
"key": "description",
456-
"value": "Package that contains actions to interact with the Slack messaging service"
457-
}
458-
],
459-
"version": "0.0.9",
460-
"namespace": "whisk.system"
461-
},
462-
...
463-
]
464-
```
465-
{: screen}
466-
467-
The OpenWhisk API supports request-response calls from web clients. OpenWhisk responds to `OPTIONS` requests with Cross-Origin Resource Sharing headers. Currently, all origins are allowed (that is, Access-Control-Allow-Origin is "`*`") and Access-Control-Allow-Headers yield Authorization and Content-Type.
468-
469-
**Attention:** Because OpenWhisk currently supports only one key per account, it is not recommended to use CORS beyond simple experiments. Your key would need to be embedded in client-side code, making it visible to the public. Use with caution.
470410

471411
## System limits
472412
{: #openwhisk_syslimits}

0 commit comments

Comments
 (0)