0

I created a function in IBM cloud which displays some JSON data when invoked. I am trying to figure out how client can consume this information. I am unable to find any information on net. I would like to preferable access the function through HTTP request or if that is not possible do it through some python script. Does anyone have more information on how this can be achieved?

NoviceMe
  • 3,126
  • 11
  • 57
  • 117

1 Answers1

1

Depending on the nature of your action/function, there are different ways to call it. In any case, you can find the required information about URL (and API key), by clicking the action in the action panel, and select 'endpoints' from there.

If you created a 'plain' action (i.e. one that accepts JSON and returns JSON), you will have to use the API key shown on the panel mentioned above. You can find it -- and the URL to use, in the 'Rest API' section. At the bottom of this page, there is also a complete curl command, which you can just copy & paste (and where you only need to insert the API key).

In case you created a web action (see here for details: https://console.bluemix.net/docs/openwhisk/openwhisk_webactions.html#openwhisk_webactions) , you can call it anonymously. The URL for that is different than the one referred to above -- you can find it in the 'web actions' section of the 'Endpoints' tab.

  • I created a plain action which returns json payload. When I try to use the public url to access the function i get following error: Authentication is possible but has failed or not yet been provided. How can I access it? – NoviceMe Dec 23 '18 at 17:24
  • based on the behavior you're describing, you likely didn't pass the API key correctly. On the 'endpoints' tab i described above, you can get the API key by clicking the API-Key hyperlink, and then using it like shown in the curl command also included on that page. Have you double-checked that? – Michael Behrendt Dec 24 '18 at 21:02