com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links' is unknown.

YahooPlaceFinder Sample

Before executing the sample, follow the instruction in section API Manager Samples. When you are done, you will have the API Manager started and the relevant scripts run to create user accounts for API Publisher and API Store. We have given below instructions specific to the "YahooPlaceFinder" Sample.

 

Note

Scripts used in this sample will not work in Windows environments. Windows support will be added in the next API Manager release.

You can submit your suggestions at https://wso2.org/jira/browse/APISTORE .   

Deploy and Test the Sample

Follow the instructions below to deploy and test the sample.

1. First, we need to add an API in the API Publisher and publish it to the API Store. To do that, simply run the APIPopulator.sh (for Linux) or APIPopulator.bat (for Windows) files in folder, <PRODUCT_HOME>/samples/YahooPlaceFinder.

2. The script will add an API to the API Publisher. Let's access Yahoo's place finder search function through this API.

3. Log in to the API Store (https://localhost:9443/store) with credentials subscriber1/subscriber1.

4. Click on the "Applications" tab at the top of the page of the API Store, and create a new application. Provide any name you prefer.

5. Click the "APIs" tab at the top of the page and select the "YahooPlaceFinder" API. Next, subscribe to this API using the newly-created application. For instructions on subscribing to an API, refer to section Subscribing to an API.

6. Click the "My Subscriptions" tab at the top of the window and select your application. Click on the "Generate" option in the box titled "Production" to obtain an Application key.

7. Once you have obtained a key, you can invoke the API using a REST client of your choice. In this example, we use cURL (http://curl.haxx.se).

8. Copy and paste following into a new console window & execute it.

curl -v -H "Authorization: Bearer 9nEQnijLZ0Gi0gZ6a3pZICktVUca" http://localhost:8280/placeFinder/1.0.0?q=Colombo

where, API key = 9nEQnijLZ0Gi0gZ6a3pZICktVUca. Replace this value with the API key you generated through the API Store in step 6 above.

9. You should be able to see search results from Yahoo Place Finder on your console. For example,

<ResultSet version="1.0">
   <Error>0</Error>
   <ErrorMessage>No error</ErrorMessage>
   <Locale>us_US</Locale>
   <Quality>40</Quality>
   <Found>1</Found>
   <Result>
      <quality>40</quality>
      <latitude>6.927200</latitude>
      <longitude>79.872200</longitude>
      <offsetlat>6.927200</offsetlat>
      <offsetlon>79.872200</offsetlon>
      <radius>6500</radius>
      <name /><line1 />
      <line2>Colombo</line2>
      <line3 />
      <line4>Sri Lanka</line4>
      <house /> <street /><xstreet /><unittype /><unit /><postal /><neighborhood />
      <city>Colombo</city>
      <county>Colombo</county>
      <state>Western</state>
      <country>Sri Lanka</country>
      <countrycode>LK</countrycode>
      <statecode /><countycode /><uzip /><hash />
      <woeid>2189783</woeid>
      <woetype>7</woetype>
   </Result>
</ResultSet>

10. Executing the above command several times with different API keys. Note the authentication failures returned by the API Gateway when you pass invalid API keys. After a few invocations, the throttling policy of the API will get activated and the API Gateway will start responding with 503 Service Unavailable response messages.


com.atlassian.confluence.content.render.xhtml.migration.exceptions.UnknownMacroMigrationException: The macro 'next_previous_links2' is unknown.