SAP / cloud-sdk-js

Use the SAP Cloud SDK for JavaScript / TypeScript to reduce development effort when building applications on SAP Business Technology Platform that communicate with SAP solutions and services such as SAP S/4HANA Cloud, SAP SuccessFactors, and many others.
Apache License 2.0
161 stars 53 forks source link

Add query to request #4723

Closed QuentinSieweAGI closed 3 weeks ago

QuentinSieweAGI commented 1 month ago

Hello,

i am currently working on a scenario where we use S/4 Hana Cloud Data on a multitenancy SaaS project. I want to know if there is a solution out of the box to forward the incoming query (previously service.run(req.query) to the destination service using getDestination() or executeHttpRequest().

When i try to send the request without any URL parameters (e.g. "/A_Products") it is working fine but when adding any parameters (e.g. "/A_Products?$count=true") the destination service is rejecting the request with a 400 response code.

Any help on this?

Florin1335BP commented 1 month ago

Hey, since you're getting a 400, are you sure that's not an oData v2 endpoint, in which case you should use $inlinecount?

QuentinSieweAGI commented 1 month ago

Hi @Florin1335BP. Yes it is an oData v2 endpoint but also $inlinecount ist not working. Also §filter or any other url parameter.

deekshas8 commented 1 month ago

Hi @QuentinSieweAGI ,

What query parameters you add to your odata service request is unrelated to the call to destinationService, so I did not entirely get what you mean there. Could you share some code snippet and the complete error logs?

You can also have a look at the docs to see how you can add different query params.

jjtang1985 commented 1 month ago

Hi @QuentinSieweAGI ,

Thanks for approaching.

service.run(req.query)

Could you please share more content of the code example above? It looks like CAP integration, but I'm not sure.

Are you using SAP Cloud SDK directly? If yes, what's the relevant code snippets?

Best regards, Junjie

deekshas8 commented 1 month ago

Hi @QuentinSieweAGI , were you able to resolve the issue? If not, could you provide some more details.

jjtang1985 commented 3 weeks ago

I'll close this ticket, as there are no updates. Please feel free to reopen.