Ankur
Ankur

Reputation: 437

Apigee PATH Suffix Manipulation

I have a proxy in APIGEE like below

API Proxy => https://somehost/base_path/employee/:id/status

Here the path suffix employee/:id/status needs to be converted to /emp/:id/status before it can be attached to target endpoint.

Target endpoint =>  https://somehost/base_path/emp/:id/status

I know this can be done using assign message or extract variable. I am new to APIGEE and hence looking for some example to understand the concept.

Upvotes: 0

Views: 2933

Answers (1)

armstb01
armstb01

Reputation: 653

Apigee shouldn't even care about converting employee to emp, the Proxy is just a pointer to the target endpoint and the endpoint can be whatever you want.

Within Edge, after you define a proxy, go to the develop tool. You'll want to create a new proxy endpoint (call it ProxyEndpoint-Employee)
In the code make it look something like:

<HTTPProxyConnection>
    <BasePath>/base_path/employee</BasePath>
    <Properties/>
    <VirtualHost>secure</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="TargetEndpoint-Employee">
    <TargetEndpoint>TargetEndpoint-Employee</TargetEndpoint>
</RouteRule>

Now create a new target endPoint called TargetEnpoint-Employee. This will be a HTTP endpoint and will look something like:

    <HTTPTargetConnection>
        <Properties/>
        <URL>https://<somehost>/<base_path>/emp</URL>
    </HTTPTargetConnection>

I do something similar to what I've explained to you for our internal API's so this should work for you.

Upvotes: 0

Related Questions