Management api to get conditional flows

Hi ,

Is there any management api to get a list of conditional flows in an api proxy or any other way to get this info?

We have a use case where we need to list down all the conditional flows in an api proxy.

Thank you,

Mahantesh

1 3 319
3 REPLIES 3

@Mahantesh IShwar , Unfortunately, I don't think there is any management API like that. Can you please give more context around the use case & why do you need it ?

But there is! There IS a way to inquire the conditional flows in an Proxy Endpoint.

Even so, I think I see your point, Anil. Apigee Edge is not a source-code control system. If a person wants to perform some analysis on the conditional flows in an API proxy, It's probably better to simply inquire the Flows from the source-code control system prior to deploying the proxy to Apigee Edge. Assuming the storage format is XML, one could use a simple XML parser on the appropriate files, to find the proxy endpoints and parse the Flows element.

Yes, you can inquire to retrieve the flows.

The hierarchy is:

• API Proxy bundle

• Proxy endpoint

• Flows

The "API Proxy bundle" is what we typically refer to as an "API Proxy". This is the thing you can import, export, deploy and undeploy.

So what you would need to do, for a particular API Proxy, is

  1. determine the revision of interest
  2. query the proxy endpoints for that revision
  3. retrieve each endpoint and parse the flows

For example:

# Query the APIs in an ORG
curl -n $mgmtserver/v1/o/ORGNAME/apis
["stadler-1", "coop", "vak-1" ]

# Query the revisions of a particular API
curl -n $mgmtserver/v1/o/ORGNAME/apis/stadler-1/revisions
[ "1", "2", "3", "4" ]

# Query the proxy endpoints for a particular revision
curl -n $mgmtserver/v1/o/ORGNAME/apis/stadler-1/revisions/4/proxies
[ "default" ]

# Query the proxy endpoint named "default" for that revision
$ curl -n $mgmtserver/v1/o/ORGNAME/apis/stadler-1/revisions/4/proxies/default
{
  "connection" : {
    "basePath" : "/stadler-1",
    "connectionType" : "httpConnection",
    "virtualHost" : [ "secure" ]
  },
  "connectionType" : "httpConnection",
  "description" : "",
  "faultRules" : [ ],
  "flows" : [ {
    "condition" : "(proxy.pathsuffix MatchesPath \"/tokeninfo\") and (request.verb = \"GET\")",
    "description" : "",
    "name" : "Flow-1",
    "request" : {
      "children" : [ {
        "Step" : {
          "faultRules" : [ ],
          "name" : "OAuthV2-GetTokenInfo"
        }
      } ]
    },
    "response" : {
      "children" : [ ]
    }
  }, {
    "condition" : "(proxy.pathsuffix MatchesPath \"/hello\") and (request.verb = \"GET\")",
    "description" : "",
    "name" : "Flow-2",
    "request" : {
      "children" : [ ]
    },
    "response" : {
      "children" : [ ]
    }
  } ],
  "name" : "default",
  "postFlow" : {
    "name" : "PostFlow",
    "request" : {
      "children" : [ ]
    },
    "response" : {
      "children" : [ ]
    }
  },
  "preFlow" : {
    "name" : "PreFlow",
    "request" : {
      "children" : [ {
        "Step" : {
          "faultRules" : [ ],
          "name" : "OAuthV2-VerifyAccessToken"
        }
      }, {
        "Step" : {
          "faultRules" : [ ],
          "name" : "AM-RemoveHeader"
        }
      } ]
    },
    "response" : {
      "children" : [ ]
    }
  },
  "routeRule" : [ {
    "empty" : true,
    "name" : "noroute"
  } ],
  "routeRuleNames" : [ "noroute" ],
  "type" : "Proxy"
}

You can see the response from the final curl call returns a proxy endpoint definition with flows including the conditions. If you like, you can retrieve it in XML format as well:

$ curl -n $mgmtserver/v1/o/ORGNAME/apis/stadler-1/revisions/4/proxies/default -H accept:application/xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
    <Description></Description>
    <FaultRules/>
    <Flows>
        <Flow name="Flow-1">
            <Description></Description>
            <Request>
                <Step>
                    <FaultRules/>
                    <Name>OAuthV2-GetTokenInfo</Name>
                </Step>
            </Request>
            <Response/>
            <Condition>(proxy.pathsuffix MatchesPath "/tokeninfo") and (request.verb = "GET")</Condition>
        </Flow>
        <Flow name="Flow-2">
            <Description></Description>
            <Request/>
            <Response/>
            <Condition>(proxy.pathsuffix MatchesPath "/hello") and (request.verb = "GET")</Condition>
        </Flow>
    </Flows>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <PreFlow name="PreFlow">
        <Request>
            <Step>
                <FaultRules/>
                <Name>OAuthV2-VerifyAccessToken</Name>
            </Step>
            <Step>
                <FaultRules/>
                <Name>AM-RemoveHeader</Name>
            </Step>
        </Request>
        <Response/>
    </PreFlow>
    <HTTPProxyConnection>
        <BasePath>/stadler-1</BasePath>
        <Properties/>
        <VirtualHost>secure</VirtualHost>
    </HTTPProxyConnection>
    <RouteRule name="noroute"/>
</ProxyEndpoint>

In the general case, there will be multiple proxy endpoints, and the name will not be "default".