2024 Feb 28 7:36 PM
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.
2024 Mar 04 12:02 PM
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.
2024 Jun 13 3:19 PM
@akuller I've tried calling RAP unbound action/function in and I also think the implementation is off. The IsBound flag seems to be true, regardless of what I did in the RAP v4 service (declaring it static). I had to make it Odata v2 for it to work