cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass filters in SAP BTP destination REST API integration in SAP Build Apps

AnjalyGeorge
Explorer
0 Kudos
2,286

Hi All,
I am trying pass filters in get operation in my SAP BTP Destination Rest API. I am passing query.condition in teh Request header. But I am getting only 2 properties in the filter value and @odata.context.Actualy I need all the properties in value as filters.

Can someone help on how to get the exact properties for filter condition.

Regards,

Anjaly

View Entire Topic
Dan_Wroblewski
Developer Advocate
Developer Advocate

The first solution you could do is to connect to your OData service with the "SAP BTP destination REST API integration". You will lose the benefits of the OData integration -- recognizing entities, filtering/paging/sorting -- but you will have control over the query parameters.

  1. Create destination to OData service.
  2. Create REST data resource with destination.
  3. For the list action, set the path to a formula, and make the formula query.search.query.
  4. Create a data variable for the data resource (collection). The data variable logic "Get record collection" will have a place to enter Search object with a single field 'query'. Set this to what you want to return, for example '/Customers?$filter=contains(CustomerID, 'AL')'
  5. When you set this response to your data variable, you will have to cut off the header (one of those things you have to do manually), so the "Record collection" will be set to a formula with this: outputs["Get record collection"].records.value

You will have to set the query string each time you retrieve records, changing the entity and the path.

Here is the data resource, including the list definition and its query parameter.

Here is the data variable logic:

And here is the formula for the query:

You can set this as a page parameter and then just build the value for the page parameter. This is a workaround and I'm sure there are limitations, but you seemingly can set anything you want in the path.

AnjalyGeorge
Explorer

daniel.wroblewski Thanks for the help.It worked for me.

madilkhan
Explorer
0 Kudos
how we can send the dynamic value to the filter.
PratikShekokar11
Explorer
0 Kudos

.

PratikShekokar11
Explorer
0 Kudos
Hello @Dan_Wroblewski, Under relative path and query I can see that text but there is only one option [ABC] where i have pasted the URL and no other field for formula. what could be the reason?
PratikShekokar11
Explorer
0 Kudos

.

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

@PratikShekokar11 Can you explain more what you are looking for and what trouble you are having?

P.S.: This question and answer is a little out of date since you can now use actions in SAP Build Apps, and in the action you can define whatever you want for the $filter property, including using placeholders and passing those when you call the action from with your app.

PratikShekokar11
Explorer
0 Kudos

.

PratikShekokar11
Explorer
Hello @Dan_Wroblewski, Thank you for your response. and regarding the issue I found the solution in one of your blog. Thanks again