cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Getting Payload in CAP NodeJS REST Service Action

jensniemeyer
Participant
0 Kudos
927

Hi,

I have created an action:

@protocol: 'rest'service RootService {
@open type object {};
action createPDF (payload: object) returns object;}

In the eventhandler I want to access the payload when I call the action:

POST {{protocol}}://{{host}}:{{port}}/rest/root/createPDFAuthorization: Basic admin:Content-Type: application/json
{ "TID": 1}

But "data" is allways emty

srv.on("createPDF", async (req, next) => { console.log(req.data) --> undefined!

Any ideas, how I can access the payload from my POST request within the CAP action?

Jens

View Entire Topic
Dinu
Active Contributor

Body should be:

{ "payload": { "TID": 1}  }
Swetha__Balusamy
Explorer
0 Kudos
I am also facing the same issue. Please let me know if you have found the solution