cancel
Showing results for 
Search instead for 
Did you mean: 

Issue Importing API Proxy After Adding Fault Rule in ProxyEndpoint

07-02-2025 8:21 AM
vaisu_raj Discoverer
327 views 0 comments
0 Likes
SAP Managed Tags
Labels
API ProxyError ExceptionIMPORT Issue
Subscribe

Dear experts,

I attempted to add a fault rule in the ProxyEndpoint of an API Proxy to handle error exceptions within the API. However, after downloading the API proxy, modifying it locally to include the fault rule, and re-importing it into SAP API Management, I encountered the following error:

vaisu_raj_0-1751436485085.png

The fault rule we have added is :

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndPoint default="true" xmlns="http://www.sap.com/apimgmt">
    <name>default</name>
    <base_path>/v1/erp/pricingsimulator/poc</base_path>
    <properties/>
    <routeRules>
        <routeRule>
            <name>default</name>
            <targetEndPointName>default</targetEndPointName>
            <sequence>1</sequence>
            <faultRules/>
        </routeRule>
    </routeRules>
    <faultRules>
        <faultRule>
            <name>NoAPIKeyError</name>
            <condition>(fault.name = "FailedToResolveAPIKey")</condition>
            <steps>
                <step>
                    <policy_name>NoAPIKeyError</policy_name>
                    <condition> </condition>
                    <sequence>1</sequence>
                </step>
            </steps>
        </faultRule>
        <faultRule>
            <name>InvalidAPIKeyError</name>
            <condition>(fault.name = "InvalidApiKey")</condition>
            <steps>
                <step>
                    <policy_name>InvalidAPIKeyError</policy_name>
                    <condition> </condition>
                    <sequence>1</sequence>
                </step>
            </steps>
        </faultRule>
        <faultRule>
            <name>BasicAuthMissing</name>
            <condition>(BasicAuthentication.decodeBasicCreds.failed = true)</condition>
            <steps>
                <step>
                    <policy_name>BasicAuthMissing</policy_name>
                    <condition> </condition>
                    <sequence>1</sequence>
                </step>
            </steps>
        </faultRule>
    </faultRules>
    <preFlow>
        <name>PreFlow</name>
        <request>
            <isRequest>true</isRequest>
            <steps>
                <step>
                    <policy_name>OAuth</policy_name>
                    <condition> </condition>
                    <sequence>1</sequence>
                </step>
            </steps>
        </request>
        <response>
            <isRequest>true</isRequest>
            <steps/>
        </response>
    </preFlow>
    <postFlow>
        <name>PostFlow</name>
        <request>
            <isRequest>true</isRequest>
            <steps/>
        </request>
        <response>
            <isRequest>true</isRequest>
            <steps>
                <step>
                    <policy_name>KVMO_GetCPIUrl</policy_name>
                    <condition> </condition>
                    <sequence>2</sequence>
                </step>
                <step>
                    <policy_name>logToElasticSearch</policy_name>
                    <condition> </condition>
                    <sequence>5</sequence>
                </step>
                <step>
                    <policy_name>generateLogMessage</policy_name>
                    <condition> </condition>
                    <sequence>3</sequence>
                </step>
                <step>
                    <policy_name>LoggingBasicAuth</policy_name>
                    <condition> </condition>
                    <sequence>4</sequence>
                </step>
                <step>
                    <policy_name>KVMO_CPICredentials</policy_name>
                    <condition> </condition>
                    <sequence>1</sequence>
                </step>
            </steps>
        </response>
    </postFlow>
    <conditionalFlows>
        <conditionalFlow>
            <name>DefaultFaultFlow</name>
            <request>
                <isRequest>true</isRequest>
                <steps>
                    <step>
                        <policy_name>defaultRaiseFaultPolicy</policy_name>
                        <condition> </condition>
                        <sequence>1</sequence>
                    </step>
                </steps>
            </request>
            <conditions>proxy.pathsuffix MatchesPath "/getsimulation" OR proxy.pathsuffix MatchesPath "/getsimulation/**" OR proxy.pathsuffix MatchesPath "/getsimulation(**"</conditions>
            <readOnly>false</readOnly>
            <sequence>1</sequence>
        </conditionalFlow>
        <conditionalFlow>
            <name>getsimulation</name>
            <conditions>(proxy.pathsuffix MatchesPath "/getsimulation" OR proxy.pathsuffix MatchesPath "/getsimulation/**" OR proxy.pathsuffix MatchesPath "/getsimulation(**")AND(request.verb = "POST")</conditions>
            <readOnly>false</readOnly>
            <sequence>0</sequence>
        </conditionalFlow>
    </conditionalFlows>
</ProxyEndPoint>

 

Queries : 

  1. What is the issue causing here ?
  2. File format we are using : Zip (Do we need to use 7-zip for this , we have compressed the file to zip file?)
  3. Does the folder name within the APIProxy during import should be in the same order as the download folder,  This is the order of the file we are importing in API.  vaisu_raj_2-1751436830826.png

Could you please help me understand what might be causing this issue?

Thanks

 

Vaisu Raj

 

 

 

 

0 Likes

Accepted Solutions (0)

Answers (0)