<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Gateway OData System Alias based API routing configuration in API management service in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/gateway-odata-system-alias-based-api-routing-configuration-in-api/qaa-p/12143747#M4539189</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This has been resolved by following action.&lt;/P&gt;&lt;P&gt;In the request API proxy API, I have included custom header and configured the APIProxyEndPoint and APITargetEndPoint files accordingly to handle dynamic routing URL.&lt;/P&gt;&lt;P&gt;1) Export the API package from the API portal and unzip the package.&lt;/P&gt;&lt;P&gt;2) open the default.xml file from APIProxyEndPoint folder and include the routeRule, conditions and targetEndPointName as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;routeRules&amp;gt;
  &amp;lt;routeRule&amp;gt;
	&amp;lt;name&amp;gt;systemERP1&amp;lt;/name&amp;gt;
	&amp;lt;conditions&amp;gt;request.header.sap-system-alias = "ERP_1"&amp;lt;/conditions&amp;gt;
	&amp;lt;targetEndPointName&amp;gt;ERP1&amp;lt;/targetEndPointName&amp;gt;
	&amp;lt;sequence&amp;gt;1&amp;lt;/sequence&amp;gt;
	&amp;lt;faultRules/&amp;gt;
  &amp;lt;/routeRule&amp;gt;
  &amp;lt;routeRule&amp;gt;
	&amp;lt;name&amp;gt;systemERP2&amp;lt;/name&amp;gt;
	&amp;lt;conditions&amp;gt;request.header.sap-system-alias = "ERP_2"&amp;lt;/conditions&amp;gt;
	&amp;lt;targetEndPointName&amp;gt;ERP2&amp;lt;/targetEndPointName&amp;gt;
	&amp;lt;sequence&amp;gt;2&amp;lt;/sequence&amp;gt;
	&amp;lt;faultRules/&amp;gt;
  &amp;lt;/routeRule&amp;gt;
&amp;lt;/routeRules&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;3) From folder APITargetEndPoint, remove default.xml and create 2 xmls with name ERP1.xml and ERP2.xml and add following lines. Keep other xml tags as is.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;TargetEndPoint&amp;gt;
    &amp;lt;name&amp;gt;ERP1&amp;lt;/name&amp;gt;
    &amp;lt;provider_id&amp;gt;GATEWAY&amp;lt;/provider_id&amp;gt;
    &amp;lt;isDefault&amp;gt;false&amp;lt;/isDefault&amp;gt;
    &amp;lt;relativePath&amp;gt;/sap/opu/odata/SALESORDER_SRV;o=ERP_1&amp;lt;/relativePath&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;4) Under root folder APIProxy folder, add targetEndPoint tags as shown below keeping all other tags as is.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;targetEndPoints&amp;gt;
        &amp;lt;targetEndPoint&amp;gt;ERP1&amp;lt;/targetEndPoint&amp;gt;
	&amp;lt;targetEndPoint&amp;gt;ERP2&amp;lt;/targetEndPoint&amp;gt;
    &amp;lt;/targetEndPoints&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;5) Zip the bundle with required API name keeping APIProxy as root folder while compressing to .zip file.&lt;/P&gt;&lt;P&gt;6)  Once imported the updated package, you will get the required routing rule as configured in the xml files.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1780593-route-rule.png" /&gt;&lt;/P&gt;&lt;P&gt;Now just test the API from any REST tool or through API Test Console with custom header 'sap-system-alias' and its required value ERP_1 or ERP_2.&lt;/P&gt;&lt;P&gt;Based on the header value, the target end point will be selected dynamically and get the results from required backend ERP/system.&lt;/P&gt;&lt;P&gt;You may also refer following links for additional details.&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2019/05/27/dynamic-routing-using-sap-cloud-platform-api-management/"&gt;https://blogs.sap.com/2019/05/27/dynamic-routing-using-sap-cloud-platform-api-management/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/66d066d903c2473f81ec33acfe2ccdb4/Cloud/en-US/5aceb48b8a644b54888db21a41f717fe.html"&gt;https://help.sap.com/viewer/66d066d903c2473f81ec33acfe2ccdb4/Cloud/en-US/5aceb48b8a644b54888db21a41f717fe.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Praveen Varriam&lt;/P&gt;</description>
    <pubDate>Sun, 16 Feb 2020 22:31:45 GMT</pubDate>
    <dc:creator>Praveen_Varriam</dc:creator>
    <dc:date>2020-02-16T22:31:45Z</dc:date>
    <item>
      <title>Gateway OData System Alias based API routing configuration in API management service</title>
      <link>https://community.sap.com/t5/technology-q-a/gateway-odata-system-alias-based-api-routing-configuration-in-api/qaq-p/12143746</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
  &lt;P&gt;I have a situation where a common OData service (example /SALESORDER_SRV) from 2 different ERP systems need to be exposed as API service. The OData works fine through Gateway system when using system alias as object in the url.&lt;/P&gt;
  &lt;P&gt;Ex: &lt;A href="https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=" target="test_blank"&gt;https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=&lt;/A&gt;&lt;STRONG&gt;ERP_1&lt;/STRONG&gt;/SalesOrderListSet(SoId=1234) &lt;/P&gt;
  &lt;P&gt;&lt;A href="https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=" target="test_blank"&gt;https://gateway-system/sap/opu/odata/sap/SALESORDER_SRV;o=&lt;/A&gt;&lt;STRONG&gt;ERP_2&lt;/STRONG&gt;/SalesOrderListSet(SoId=6789)&lt;/P&gt;
  &lt;P&gt;Using API management service of SCP, I have configured API provider for the gateway and I could create API for the above mentioned OData service.&lt;/P&gt;
  &lt;P&gt;Now that, in the Target Endpoint section, the URL is without system alias object in it.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1782535-odata-api-1.png" /&gt;&lt;/P&gt;
  &lt;P&gt; How to add the specific system alias into the Target EndPoint service through Proxy EndPoint service call?&lt;/P&gt;
  &lt;P&gt;If the client application consume this above mentioned API service and trigger with 'system_alias' as header parameter, whether this can be extracted using Policy Type (Extract Variable) and then set the 'system_alias' header value to Target EndPoint Properties?&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;
  &lt;P&gt;Praveen Varriam &lt;/P&gt;</description>
      <pubDate>Sat, 15 Feb 2020 01:01:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/gateway-odata-system-alias-based-api-routing-configuration-in-api/qaq-p/12143746</guid>
      <dc:creator>Praveen_Varriam</dc:creator>
      <dc:date>2020-02-15T01:01:30Z</dc:date>
    </item>
    <item>
      <title>Re: Gateway OData System Alias based API routing configuration in API management service</title>
      <link>https://community.sap.com/t5/technology-q-a/gateway-odata-system-alias-based-api-routing-configuration-in-api/qaa-p/12143747#M4539189</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;This has been resolved by following action.&lt;/P&gt;&lt;P&gt;In the request API proxy API, I have included custom header and configured the APIProxyEndPoint and APITargetEndPoint files accordingly to handle dynamic routing URL.&lt;/P&gt;&lt;P&gt;1) Export the API package from the API portal and unzip the package.&lt;/P&gt;&lt;P&gt;2) open the default.xml file from APIProxyEndPoint folder and include the routeRule, conditions and targetEndPointName as shown below.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;routeRules&amp;gt;
  &amp;lt;routeRule&amp;gt;
	&amp;lt;name&amp;gt;systemERP1&amp;lt;/name&amp;gt;
	&amp;lt;conditions&amp;gt;request.header.sap-system-alias = "ERP_1"&amp;lt;/conditions&amp;gt;
	&amp;lt;targetEndPointName&amp;gt;ERP1&amp;lt;/targetEndPointName&amp;gt;
	&amp;lt;sequence&amp;gt;1&amp;lt;/sequence&amp;gt;
	&amp;lt;faultRules/&amp;gt;
  &amp;lt;/routeRule&amp;gt;
  &amp;lt;routeRule&amp;gt;
	&amp;lt;name&amp;gt;systemERP2&amp;lt;/name&amp;gt;
	&amp;lt;conditions&amp;gt;request.header.sap-system-alias = "ERP_2"&amp;lt;/conditions&amp;gt;
	&amp;lt;targetEndPointName&amp;gt;ERP2&amp;lt;/targetEndPointName&amp;gt;
	&amp;lt;sequence&amp;gt;2&amp;lt;/sequence&amp;gt;
	&amp;lt;faultRules/&amp;gt;
  &amp;lt;/routeRule&amp;gt;
&amp;lt;/routeRules&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;3) From folder APITargetEndPoint, remove default.xml and create 2 xmls with name ERP1.xml and ERP2.xml and add following lines. Keep other xml tags as is.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;TargetEndPoint&amp;gt;
    &amp;lt;name&amp;gt;ERP1&amp;lt;/name&amp;gt;
    &amp;lt;provider_id&amp;gt;GATEWAY&amp;lt;/provider_id&amp;gt;
    &amp;lt;isDefault&amp;gt;false&amp;lt;/isDefault&amp;gt;
    &amp;lt;relativePath&amp;gt;/sap/opu/odata/SALESORDER_SRV;o=ERP_1&amp;lt;/relativePath&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;4) Under root folder APIProxy folder, add targetEndPoint tags as shown below keeping all other tags as is.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;    &amp;lt;targetEndPoints&amp;gt;
        &amp;lt;targetEndPoint&amp;gt;ERP1&amp;lt;/targetEndPoint&amp;gt;
	&amp;lt;targetEndPoint&amp;gt;ERP2&amp;lt;/targetEndPoint&amp;gt;
    &amp;lt;/targetEndPoints&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;5) Zip the bundle with required API name keeping APIProxy as root folder while compressing to .zip file.&lt;/P&gt;&lt;P&gt;6)  Once imported the updated package, you will get the required routing rule as configured in the xml files.&lt;/P&gt;&lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/1780593-route-rule.png" /&gt;&lt;/P&gt;&lt;P&gt;Now just test the API from any REST tool or through API Test Console with custom header 'sap-system-alias' and its required value ERP_1 or ERP_2.&lt;/P&gt;&lt;P&gt;Based on the header value, the target end point will be selected dynamically and get the results from required backend ERP/system.&lt;/P&gt;&lt;P&gt;You may also refer following links for additional details.&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2019/05/27/dynamic-routing-using-sap-cloud-platform-api-management/"&gt;https://blogs.sap.com/2019/05/27/dynamic-routing-using-sap-cloud-platform-api-management/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://help.sap.com/viewer/66d066d903c2473f81ec33acfe2ccdb4/Cloud/en-US/5aceb48b8a644b54888db21a41f717fe.html"&gt;https://help.sap.com/viewer/66d066d903c2473f81ec33acfe2ccdb4/Cloud/en-US/5aceb48b8a644b54888db21a41f717fe.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Praveen Varriam&lt;/P&gt;</description>
      <pubDate>Sun, 16 Feb 2020 22:31:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/gateway-odata-system-alias-based-api-routing-configuration-in-api/qaa-p/12143747#M4539189</guid>
      <dc:creator>Praveen_Varriam</dc:creator>
      <dc:date>2020-02-16T22:31:45Z</dc:date>
    </item>
  </channel>
</rss>

