2017-08-23 46 views
0

我想通过调用OpenWhisk操作在API Connect中创建一个POST API方法。我在James Thomas的文章Serverless APIs with OpenWhisk and API Connect中使用GET方法作为连接和配置设置的模板,以将OpenWhisk操作集成到API中。我使用的OpenWhisk Action成功地将输入数据发布到Compose PostgreSQL数据库,所以我需要做的就是正确地调用它并通过API Connect将正确格式的输入数据发送到OpenWhisk函数。 对IBM API的开发者控制台我的当前请求和响应输出为:未能将OpenWhisk操作集成到PostgreSQL数据库到API连接

Request POST https://api.us.apiconnect.ibmcloud.com/spatvis-tutorial/sb/post-trial/student Headers: Content-Type: application/json Accept: application/json X-IBM-Client-Id: ******************************** X-IBM-Client-Secret: ******************************* Response Code: 401 Unauthorized Headers: x-global-transaction-id: 114129529 content-type: application/json {}

的OpenWhisk功能没有被调用,我想不通为什么我收到的安全错误。我需要什么样的凭证,以及如何设置?使用文章Three approaches to securing access to Bluemix applications with IBM API Connect中概述的TLS,基本和自定义HTTP安全技术是否合理?如果是这样,每种技术/方法的优点和缺点是什么?哪一个最适合用来保护对OpenWhisk Actions的访问?

回答

0

自该博客文章发布以来,OpenWhisk拥有released native API Gateway integration

将操作连接到HTTP端点可以使用Bluemix上的wsk cliweb management interface进行管理。

以下是使用用于POST请求的API网关创建HTTP端点的示例。

$ wsk api create /api/action POST action 
ok: created API /api/action POST for action /_/action 
https://service.us.apiconnect.ibmcloud.com/gws/apigateway/api/<UUID>/api/action 

blog post给出了新功能的演练。