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

How to use parameterized external service programatically in CAP node.js

KM11
Product and Topic Expert
Product and Topic Expert
2,207

Hi Experts

I need to programmatically call an external parameterized service in my cap application.

External service url:

/servicename/ABC(Key=‘123’)/Set


CAP service.cds file:

entity Abc(Key:String(3)) as projection on ext.ABC;


CAP Node.js call: srv.run(SELECT.from(‘Abc(Key:’123’)’)); // tried passing in single quotes and template string both

This created a url like: dest.servicename/?$select=Key


Note: The external service is made out of calc view with parameters


Kindly help. david.kunz2 gregorwolf

Thanks

Kanika

View Entire Topic
david_kunz2
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi kanikamalhotra ,

"Key" is a reserved keyword, so it must be escaped and you don't need quotes around the value.

SELECT.from('Abc(![Key]:123)')

Best regards,
David