cancel
Showing results for 
Search instead for 
Did you mean: 

How to catch Payload attachment in CAP NODEJS ?

0 Kudos

Hello EveryOne,

I am working on Media upload in CAP but not able to catch File inside Nodejs.

Here are few screenshots.

Postman Body

Postman Header

CAP Side data where content is not capturing.

CAP entity and service.

Regards,

Singh

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

I think your application works fine and you can just read from req.data.content. It is probably not shown in the console because it is a binary?

0 Kudos

willem.pardaens No attachment should appear in req.data.content, I deployed on BTP there also it is blank.

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

Have you tried switching the DmsPostFile service from odata to rest (@protocol: 'rest') ? That removes data validation of the incoming payload. Bear in mind this will also change the url it is exposed through.

0 Kudos

willem.pardaens No it doesn't work

Willem_Pardaens
Product and Topic Expert
Product and Topic Expert
0 Kudos

Last thing I can think of: in another similar project I used the LargeString data type to receive an uploaded file instead of LargeBinary. Once received in the CAP handler I used Buffer.from() to read it.

0 Kudos

No, LargeString can't be used as LargeBinary. It will be not possible to send LargeString data into Standard API parameter which is type of LargeBinary.

0 Kudos

gregorw gregor.wolf Could you please help here.

View Entire Topic
0 Kudos

oliver.klemenz gregorw . Can you please help here?

kallolathome
Active Participant
0 Kudos

Yes, I have also faced the same issue in case of .XLSX/.CSV files. The OData V2 supports it but not able to do it.

0 Kudos

kallolathome Did you found the solution? I am uploading all types of file.