jpkessle commented on a change in pull request #3244: Move parameter docs to 
separate page, add package params docs
URL: 
https://github.com/apache/incubator-openwhisk/pull/3244#discussion_r165733535
 
 

 ##########
 File path: docs/parameters.md
 ##########
 @@ -0,0 +1,180 @@
+# Working with parameters
+
+### Passing parameters to an action at invoke time
+
+Parameters can be passed to the action when it is invoked.  These examples use 
JavaScript but all the other languages work the same way.
+
+1. Use parameters in the action. For example, update the 'hello.js' file with 
the following content:
+
+  ```javascript
+  function main(params) {
+      return {payload:  'Hello, ' + params.name + ' from ' + params.place};
+  }
+  ```
+
+  The input parameters are passed as a JSON object parameter to the `main` 
function. Notice how the `name` and `place` parameters are retrieved from the 
`params` object in this example.
+
+2. Update the action so it is ready to use:
+
+  ```
+  wsk action update hello hello.js
+  ```
+
+3.  Parameters can be provided explicitly on the command-line, or by supplying 
a file containing the desired parameters
+
+  To pass parameters directly through the command-line, supply a key/value 
pair to the `--param` flag:
+  ```
+  wsk action invoke --result hello --param name Dorothy --param place Kansas
+  ```
+
+  In order to use a file containing parameter content, create a file 
containing the parameters in JSON format. The
+  filename must then be passed to the `param-file` flag:
+
+  Example parameter file called parameters.json:
+  ```json
+  {
+      "name": "Dorothy",
+      "place": "Kansas"
+  }
+  ```
+
+  ```
+  wsk action invoke --result hello --param-file parameters.json
+  ```
+
+  ```json
+  {
+      "payload": "Hello, Dorothy from Kansas"
+  }
+  ```
+
+  Notice the use of the `--result` option: it implies a blocking invocation 
where the CLI waits for the activation to complete and then
 
 Review comment:
   Remove white space at end of line, ie; merge/bring up the next line.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to