Skip to content

Commit

Permalink
updated sample to use weather API and WOEIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
u2000 committed Oct 7, 2013
1 parent 2fdc0fd commit 8375160
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 49 deletions.
24 changes: 0 additions & 24 deletions sample-proxies/target-reroute/apiproxy/getsat.xml

This file was deleted.

19 changes: 13 additions & 6 deletions sample-proxies/target-reroute/apiproxy/policies/ExtractId.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
<ExtractVariables async="false" continueOnError="false" enabled="true" name="ExtractId">
<DisplayName>getObjectNumberfromPath</DisplayName>
<!-- A WOEID (Where on Earth Identifier) is a unique 32 bit reference identifier assigned by Yahoo! to identify any feature on Earth. -->

<ExtractVariables name="extractId">
<DisplayName>getWOEIDNumberfromPath</DisplayName>
<!-- Pull the WEOID from the request path and populate a variable called 'location'.
The prefix WOEID is defined below, to create the variable WOEID.location.
-->
<URIPath>
<Pattern ignoreCase="true">/objects/{uri}</Pattern>
<Pattern ignoreCase="true">/{location}</Pattern>
</URIPath>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<VariablePrefix>path</VariablePrefix>
</ExtractVariables>
<!-- Continue processing without an error if the WOEID variable cannot be resolved (a bad request for example). -->
<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
<!-- The prefix for the variable name that will be referenced by the JavaScript. -->
<VariablePrefix>WOEID</VariablePrefix>
</ExtractVariables>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Javascript name="rewriteTargetUrl">
<ResourceURL>jsc://rewriteTargetUrl.js</ResourceURL>
</Javascript>

This file was deleted.

18 changes: 6 additions & 12 deletions sample-proxies/target-reroute/apiproxy/proxies/default.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ProxyEndpoint name="default">
<Description></Description>
<FaultRules/>
<Flows/>
<PreFlow name="PreFlow">
<Request>
<Step>
<FaultRules/>
<Name>ExtractId</Name>
</Step>
</Request>
<!-- During the request flow, extract the WEOID that was presented in the request. -->
<Request><Step><Name>extractId</Name></Step></Request>
</PreFlow>
<HTTPProxyConnection>
<BasePath>/yahoo</BasePath>
<Properties/>
<!-- All requests sent to '{org-name}-test.apigee.net/WEOID' will be handled by this API proxy. -->
<BasePath>/WOEID</BasePath>
<!-- Use the default virtual host configuration to set the network address for this proxy: '{org-name}-test.apigee.net -->
<VirtualHost>default</VirtualHost>
</HTTPProxyConnection>
<RouteRule name="YahooRoute">
<!-- Forward requests to the TargetEndpoint configuration named 'default'. -->
<TargetEndpoint>default</TargetEndpoint>
</RouteRule>
</ProxyEndpoint>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions sample-proxies/target-reroute/apiproxy/rewriteTargetUrl.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<APIProxy revision="21" name="rewriteTargetUrl">
</APIProxy>
4 changes: 2 additions & 2 deletions sample-proxies/target-reroute/apiproxy/targets/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
<Request>
<Step>
<FaultRules/>
<Name>setJsHeader</Name>
<Name>rewriteTargetUrl</Name>
</Step>
</Request>
</PreFlow>
<HTTPTargetConnection>
<Properties/>
<URL>http://my-dummy-old-target.com/to-be-replaced</URL>
<URL>http://weather.yahooapis.com</URL>
</HTTPTargetConnection>
</TargetEndpoint>
2 changes: 1 addition & 1 deletion sample-proxies/target-reroute/invoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ source ../../setup/setenv.sh

set -x

curl http://$org-$env.apigee.net/yahoo/objects/12797282
curl http://$org-$env.apigee.net/WOEID/2467861

0 comments on commit 8375160

Please sign in to comment.