Skip to Content
0
Feb 27 at 09:27 AM

Pass empty values to optional Query parameters SAP APIM

126 Views

Hi Experts,

We are working on SAP APIM to pass some 11 query parameters values from source to target URL.

We have source URL something like below (strings in bold are source query parameter names).

As you can see there are around 10 query parameters coming from Source system.

https://<host>/org/v1/api/compdata/vendor_profile?companyno=06598‚ąĀanyname=&siteno=&sitename=&address=&city=&state=&postal=&country=&pagesize=

Target URL looks something like below.

http://<host>:<port>/OrgDev/rest/v1/datasources/VENDOR_PROFILE/execute?COUNTRY='{country}'&COMPANY_NAME='{companyname}'&COMPANY_NUMBER='{companyno}'&SSP_NUMBER='{siteno}'&SSP_NAME='{sitename}'&SSP_ADDRESS='{address}'&SSP_CITY_COUNTY='{city}'&SSP_STATE='{state}'&SSP_POSTAL_CODE='{postal}'&pagesize='{pagesize}'

I could above requirement using AssignMessage policy. Now the requirement is if corresponding query parameters are not coming in input URL then empty or null value has to be passed to respective query parameter on target side.

For example, if companyname , siteno, sitename, pagesize are not present then empty value has to be passed to be passed to target.

For example, if source URL dont have companyname , siteno, sitename, pagesize parameters.

https://<host>/org/v1/api/compdata/vendor_profile?companyno=06598&address=&city=&state=&postal=&country=

Target URL should look like below.

http://<host>:<port>/OrgDev/rest/v1/datasources/VENDOR_PROFILE/execute?COUNTRY$PARAM='{country}'&COMPANY_NAME$PARAM=&COMPANY_NUMBER$PARAM=06598&SSP_NUMBER$PARAM=&SSP_NAME$PARAM=&SSP_ADDRESS$PARAM=&SSP_CITY_COUNTY$PARAM=&SSP_STATE$PARAM=&SSP_POSTAL_CODE$PARAM=&pagesize=

Thanks!