Apigee 4MV4D - Programming of APIs - Series - Request, Response, Flow Variables - S01E04

Hello Apigeeks,

Here is the fourth 4MV4D "Request, Response, Flow Variables " part of Programming of APIs series that talks about how to use flow variables in Apigee Edge & Do API Programming in API Layer instead of changing complex code on your backend.

Apigee Edge sits in between your client that makes API call & server where your existing APIs or legacy services are running. You will have full control of request & response in API Layer which you can use to do validation/message transformation before you send the request to target server or send the response to the client.

In above video, We use http://httpbin.org/get as target API to create a simple API Proxy in Apigee Edge. We will leverage flow variables to modify the request that is sent to target server using Assign Message Policy.

For your reference, see the policy code below,

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<AssignMessage name="CopyQueryParamToHeader">
    <DisplayName>populateHeaderFromQueryParam</DisplayName>
    <AssignTo createNew="false" type="request"/>
    <Set>
        <Headers>
            <Header name="findme">{request.queryparam.search}</Header>
        </Headers>
    </Set>
    <Remove>
        <QueryParams>
            <QueryParam name="search"/>
        </QueryParams>
    </Remove>
</AssignMessage>

In above policy, we read the query param "search" using flow variable "request.queryparam.search" & create a new header "findme" which will be sent to target server.

Apigee populates hundreds of flow variables for every API call that will be available on API runtime flow to do API Programming on Apigee Edge. You can find Variables Reference doc here which lists all the variables & context where you can use them.

Find out more about how APIGEE Edge Intelligent API platform can help you scale, build, manage, secure your APIs & bring visibility into your API program using API Analytics and more in upcoming videos. Don't forget to subscribe to channel here.

Please feel free to leave a comment below if you have any feedback / Post a new question if you have any queries.

Version history
Last update:
‎12-28-2016 01:18 AM
Updated by: