Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

call unbound RAP action from CAP

akuller_q
Participant
0 Kudos

Hello everyone,

I am trying to call an unbound action in RAP using CAP.

Based on the documentation I'm trying the send method: https://cap.cloud.sap/docs/node.js/core-services#srv-send-request

 

const remote = await cds.connect.to("api")
..
let a = await remote.send('entity/namespace.action',{parameters})
console.log(a)
...

 

No matter what I tell him, right or wrong, he always tells me undefined.

 

When I call the service via rest client, I receive a correct response.

POST dest.dest/path.../entity/namespace.action
Content-Type: application/json

{parameters}

If I try to call an entity, there is no error/the correct answer.

 

Has anyone managed a call or an idea what I am doing wrong?

 

Thank you very much.

Best regards.

 

By the way, has anyone looked at the curiosity of an unbound action under RAP? I thought the service was built incorrectly.

 

1 REPLY 1

akuller_q
Participant
0 Kudos

I have found a possible solution, but I can imagine that this is what the author had in mind.

await remote.send('POST', 'service.entity/namespace.action', {parameters)

I am very open to further approaches/ideas.