0

I have an IBM Cloud Function like:

 return {'body': csv_output.getvalue(),
            'headers': {'Content-Type': 'text/csv',
            'Content-Disposition': 'attachment;filename=dat.csv'}}

When called a public API endpoint it returns a csv file with right data.

But when I use postman to make a REST API endpoint call I get a weird result like:

{
    "annotations": [
        {
            "key": "exec",
            "value": "python:3.7"
        },
        {
            "key": "web-export",
            "value": true
        },
        {
            "key": "final",
            "value": true
        },
        {
            "key": "raw-http",
            "value": true
        }
    ],
    "exec": {
        "kind": "python:3.7",
        "code": "import 

Can someone please tell me what am I doing wrong? Seems like I am getting code back rather than invoking the function.

enter image description here

NoviceMe
  • 3,126
  • 11
  • 57
  • 117

1 Answers1

1

It looks like you are using POSTMAN to return actions details (via the platform API), rather than invoking as a web action.

The HTTP endpoint for an action is https://{APIHOST}/api/v1/namespaces/_/actions/<ACTION_NAME>.

The HTTP endpoint for invoking an action as a web action is https://{APIHOST}/api/v1/web/{QUALIFIED ACTION NAME}.{EXT}.

James Thomas
  • 4,303
  • 1
  • 20
  • 26