Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 8c91221

Browse files
committed
Update documentation for HTTP path parameters
1 parent b06477c commit 8c91221

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,28 @@ Date: Mon, 19 Dec 2016 15:47:53 GMT
713713

714714
Functions exposed through the API Gateway service are automatically converted into Web Actions during deployment. The framework [secures Web Actions for HTTP endpoints](https://github.com/apache/incubator-openwhisk/blob/master/docs/webactions.md#securing-web-actions) using the `require-whisk-auth` annotation. If the `require-whisk-auth` annotation is manually configured, the existing annotation value is used, otherwise a random token is automatically generated.
715715

716+
### URL Path Parameters
717+
718+
The API Gateway service [supports path parameters]() in user-defined HTTP paths. This allows functions to handle URL paths which include templated values, like resource identifiers.
719+
720+
Path parameters are identified using the `{param_name}` format in the URL path. The API Gateway sends the full matched path value in the `__ow_path` field of the event parameters.
721+
722+
```yaml
723+
functions:
724+
retrieve_users:
725+
handler: users.get
726+
events:
727+
- http:
728+
method: GET
729+
path: /users/{id}
730+
resp: http
731+
```
732+
733+
This feature comes with the following restrictions:
734+
735+
- *Path parameters are only supported when `resp` is configured as`http`.*
736+
- *Individual path parameter values are not included as separate event parameters. Users have to manually parse values from the full `__ow_path` value.*
737+
716738
## Exporting Web Actions
717739

718740
Functions can be turned into "*web actions*" which return HTTP content without use of an API Gateway. This feature is enabled by setting an annotation (`web-export`) in the configuration file.

0 commit comments

Comments
 (0)