is It possible to create API Proxy having parameterize base URL

Not applicable

I want to create an API proxy having base url something like:

\clients\{clientid}\product\

and later i want to extract the client id for further process

is there any way ??

Solved Solved
0 5 844
1 ACCEPTED SOLUTION

Not applicable

Basepath cannot be URI.Thatswhy you are not able to define the pattern for extraction in URIPath.

Also,you cannot have changing basepath(here "clientid").When you create Basepath you cannot give * in the path.

View solution in original post

5 REPLIES 5

Not applicable

Hi,

I think you are asking something related to a sample given under Extract Variable Policy

REF:http://apigee.com/docs/api-services/reference/extr...

Please check this one.

<ExtractVariables name="ExtractVariables-1">
   <DisplayName>Extract a portion of the url path</DisplayName>
   <Source>request</Source>
   <URIPath>
      <Pattern ignoreCase="true">/accounts/{id}</Pattern>
   </URIPath>
   <VariablePrefix>urirequest</VariablePrefix>
   <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</ExtractVariables>

Hi,

I tried this but i am unable to extract variable which comes under basepath of my API proxy.

BasePath:

/clients/*/assist

Resource:

/v1/converter

Now here's my url:

/clients/mct/assist/v1/converter?

now i want extract 'mct' from the above url thorough message extract policy but i am getting 'null'

Extract variable policy:

<DisplayName>Extract Variables 1</DisplayName>
   <URIPath>
     <Pattern ignoreCase="true">/clients/{clientid}/assist/**</Pattern>
  </URIPath>
    <VariablePrefix>REQ</VariablePrefix>

i am able to extract variable if it is in resource path but the same thing is not working for basepath

Not applicable

Basepath cannot be URI.Thatswhy you are not able to define the pattern for extraction in URIPath.

Also,you cannot have changing basepath(here "clientid").When you create Basepath you cannot give * in the path.

@Vinay Soni and @Anil Sagar

I think I am still able to achieve Vinay Soni's requirement.

I did as below,

I created a Proxy basepath as /dynamicbasepath/*/test

And able to extract the dynamic value as below

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ExtractVariables async="false" continueOnError="false" enabled="true" name="Extract-Variables-1">
    <DisplayName>Extract Variables-1</DisplayName>
    <Variable name="proxy.url">
        <Pattern>*/dynamicbasepath/{dynamic_value}/test</Pattern>
    </Variable>
</ExtractVariables>

Dear @Vinay Soni ,

Welcome to Apigee Community.

As said by, @RadhamaniRamadoss basepath cannot be dynamic. Please check duplicate question i have marked here for more details.

You need to move your dynamic paths to resources / conditional flows and use extract variables policy to extract same. Please keep us posted if you have any queries.

Cheers,

Anil Sagar