cancel
Showing results for 
Search instead for 
Did you mean: 

HCI Odata API dynamic query

0 Kudos
842

Hi experts

The requirement is to pass the top paramter of the Odata API query dynamically.

Based on the input paylod value, this top parameter should be modified and passed to the API.

For ex : Below is the query where we need to pick the top 10 Campaign objects.

https://xxxxxx.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CAMPAIGN_SRV/Campaigns?$top=10&$filter=CampaignCategory eq 'abc' and CampaignLifecycleStatus eq '2'&$orderby=CampaignPriority desc&$format=json&$expand=CampaignAssignedTargetGroups

This value 10 should change based on the input payload value ( we could also maintain a value mapping for the same)

Kindly provide your suggestions.

Regards

Sudarvizhi P

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Thanks Sriprasad Shivaram Bhat. Let me try this

Sriprasadsbhat
Active Contributor
0 Kudos

Hello Sudarvizhi,

Add content modifier just before your request reply and set the header [ For Ex topval ] with whatever value you need and call the same in your channel like below

https://xxxxxx.s4hana.ondemand.com/sap/opu/odata/sap/API_MKT_CAMPAIGN_SRV/Campaigns?$top=${header.topval}&$filter=CampaignCategory eq 'abc' and CampaignLifecycleStatus eq '2'&$orderby=CampaignPriority desc&$format=json&$expand=CampaignAssignedTargetGroups

Regards,

Sriprasad Shivaram Bhat

czzzh
Explorer
0 Kudos

Hello Sriprasad

Do you know the reason why postman does not return the $expand content, only the root content?

Thanks