cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Payload in CAP NodeJS REST Service Action

jensniemeyer
Participant
0 Kudos

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
Contributor

Body should be:

{ "payload": { "TID": 1}  }