1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | wsk -v action invoke /whisk.system/samples/echo -p message hello --blocking --result {'apihost': 'openwhisk.ng.bluemix.net', 'namespace': 'user@example.com_dev', 'clibuild': '2016- 05-24T09:54:44-05:00', 'apiversion': 'v1'} ======== REQUEST: POST https://openwhisk.ng.bluemix.net/api/v1/namespaces/whisk.system/actions/samples/echo? blocking=true&result=true Headers sent: { "Authorization": "Basic S3sjGo6dKeKSIIRENS135xOsT3jEs7IiS3sjGo6dKeKSIIRENS135xOsT3jEs7Ii", "Content-Type": "application/json" } Body sent: {"message": "hello"} -------- RESPONSE: Got response with code 200 Body received: { "message": "hello" } ======== { "message": "hello" } |
wsk -v action invoke /whisk.system/samples/echo -p message hello --blocking --result |
1 2 3 4 5 | export OPENWHISK_APIHOST="openwhisk.ng.bluemix.net" export OPENWHISK_NAMESPACE="username@example.com_dev" export OPENWHISK_TOKEN="S3sjGo6dKeKSIIRENS135xOsT3jEs7IiS3sjGo6dKeKSIIRENS135xOsT3j Es7Ii" |
1 2 3 | function main() { return {payload: 'good day'}; } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from openwhisklib import * >>> createAction( 'goodday.js', 'goodday') Issuing put request: url=https://openwhisk.ng.bluemix.net/api/v1/namespaces/user@example.com_dev/actions/goodday payload: {'exec': {'kind': 'nodejs', 'code': "function main() {\n return {payload: 'good day'};\n}\n"}} headers={'content-type': 'application/json', 'Authorization': 'Basic S3sjGo6dKeKSIIRENS135xOsT3jEs7IiS3sjGo6dKeKSIIRENS135xOsT3jEs7Ii'} Response status_code=200 { "name": "goodday", "publish": false, "annotations": [], "version": "0.0.1", "exec": { "kind": "nodejs", "code": "function main() {\n return {payload: 'good day'};\n}\n" }, "parameters": [], limits": { "timeout": 60000, "memory": 256 }, "namespace": "user@example.com_dev" } <Response [200]> >>> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | >>> >>> invokeAction('goodday') Issuing request: url=https://openwhisk.ng.bluemix.net/api/v1/namespaces/user@example.com_dev/actions/goodday? blocking=true&result=false payload={} headers={'content-type': 'application/json', 'Authorization': 'Basic S3sjGo6dKeKSIIRENS135xOsT3jEs7IiS3sjGo6dKeKSIIRENS135xOsT3jEs7Ii'} Response status_code=200 { "name": "goodday", "subject": "user@example.com", "activationId": "f81398a389734d018f4c92fbf59e2dbe", "publish": false, "annotations": [], "version": "0.0.1", "response": { "result": { "payload": "good day" }, "success": true, "status": "success" }, "end": 1466083636776, "logs": [], "start": 1466083636724, "namespace": "user@example.com" } <Response [200]> >>> >>> |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |