Walkthrough 5-2: Create and deploy an API proxy

In this walkthrough, you create and deploy an API proxy for your API implementation on CloudHub. You will:

·       Add an API to API Manager.

·       Use API Manager to create and deploy an API proxy application.

·       Set a proxy consumer endpoint so requests can be made to it from Exchange.

·       Make calls to an API proxy from API portals for both internal and external developers.

·       View API request data in API Manager.        

 

Starting file

This walkthrough uses Anypoint Platform. There is no starting file. To complete the walkthrough, you must have completed the preceding walkthrough.

Create and deploy a proxy application

1.     Return to Anypoint Platform.

2.     In the main menu, select API Manager; you should see no APIs listed.

 

3.     Click the Manage API button and select Manage API from Exchange.

 

4.     For API name, start typing American in the text field and then select your American Flights API in the drop-down menu that appears.

5.     Set the rest of the fields to the following values:

·       Asset type: RAML/OAS

·       API version: v1

·       Asset version: 1.0.2

·       Managing type: Endpoint with Proxy

·       Proxy deployment target: CloudHub

·       Implementation URI: http://training4-american-ws-{lastname}.{region}.cloudhub.io/api

       

6.     Select the checkbox Check this box if you are managing this API in Mule 4 or above.

 

7.     Click Save.

8.     Scroll down if necessary and in the Deployment Configuration section, set the following values:

·       Runtime version: 4.3.0

·       Proxy application name: training4-american-api-{lastname}

9.     Check Update application if exists.

  

10.  Click Deploy.

Note: If you get an error message that the deployment failed, refresh the Runtime Manager page in the browser and ensure the newly deployed application is listed.

11.  In the Deploying to CloudHub dialog box, click the Click here link to see the logs.

12.  In the new browser tab that opens, watch the logs in Runtime Manager.

 

13.  Wait until the proxy application starts.

Note: If it does not successfully deploy, read the logs to help figure out why the application did not deploy. If you had errors when deploying, troubleshoot them, fix them, and then redeploy.

14.  In the left-side navigation, select Applications; you should see the proxy application.

15.  Click the row for the proxy and review its information in the right section of the window.

16.  Close the browser tab.

View API details in API Manager

17.  Return to the tab with API Manager and click the Close button in the Deploying to CloudHub dialog box.

18.  Review the API proxy information at the top of the page.

19.  In the left-side navigation, click the API Administration link; you should now see your American Flights API listed.

20.  Click in the row for the v1 version – but not on the v1 link.

21.  Review the API version info that appears on the right side of the window; you should see there are no policies, SLA tiers, or client applications.

22.  In the API list, click the v1 link for the API; you should be returned to the Settings page for the API.

23.  Locate and review the links on the right side of the page.

 

24.  Click the View configuration details link.

  

25.  In the Endpoint configuration details dialog box, click Close.

26.  On the Settings page, look at the requests graph; you should not see any API requests yet.

  

View the new API proxy instance in Exchange

27.  Return to the browser tab with Exchange.

28.  Return to the home page for your American Flights API.

29.  Locate the API instances now associated with asset version 1.0.2; you should see the Mocking Service instance and now the new proxy.

  

Note: You may need to refresh your browser page.

30.  Click the GET method for the flights resource.

31.  In the API console, click the drop-down arrow next to Mocking Service; you should NOT see the API proxy as a choice.

 

32.  In the left-side navigation, select API instances; you should see that the new proxy instance does not have a URL.

 

Set a friendly label for the API instance in API Manager 

33.  Return to the browser tab with API Manager.

34.  On the Settings page for your American Flights API, click the Add a label link.

35.  Set the label to No policy and press Enter/Return.

  

Set a consumer endpoint for the proxy in API Manager

36.  Locate the proxy URL.

 

37.  Right-click it and copy the link address.

38.  Click the Add consumer endpoint link.

 

39.  Paste the value of the proxy URL.

40.  Press Enter/Return.

  

Make requests to the API proxy from Exchange

41.  Return to the browser tab with Exchange.

42.  Refresh the API instances page for your American Flights API; you should see the new label and the URL.

43.  In the left-side navigation, select Home to return to the API's main page.

44.  Locate the API instances now associated asset version 1.0.2; you should see the new label for the API instance.

  

45.  Click the GET method for the flights resource.

46.  In the API console, click the drop-down arrow next to Mocking Service; you should now see your API proxy instance as a choice.

 

47.  Select the Sandbox - No policy instance.

48.  Click the Send button; you should now see the real data from the database, which contains multiple flights.

 

49.  Make several more calls to this endpoint.

50.  Make calls to different methods.

Make requests to the API proxy from the public portal

51.  Return to the public portal in the private/incognito window.

52.  Click the GET method for the flights resource.

53.  In the API reference section, click the drop-down arrow next to Mocking Service; you should NOT see your API proxy instance as a choice.  

Make an API instance visible in the public portal

54.  Return to the browser with Exchange.

55.  In the left-side navigation for American Flights API, select API instances.

56.  Change the visibility of the No policy instance from private to public.

57.  Return to the public portal in the private/incognito window.

58.  Refresh the page.

59.  In the API console, change the API instance from Mocking Service to Sandbox - No policy.

 

60.  Click Send; you should a 200 response and flight data.

Look at the API request data

61.  Return to the browser tab with API Manager.

62.  Refresh the Settings page for you American Flights API.

63.  Look at the Request chart again; you should now see data for some API calls.

 

64.  Click the View Analytics Dashboard link located in the upper-right corner.

65.  In the Date Range drop-down menu near the upper-left corner, select 1 Hour.

66.  Review the data in the dashboard.

 

67.  Close the browser tab.



Did you complete the walkthrough?

  Yes, I completed the walkthrough

  No, I did not complete the walkthrough

  I completed part of the walkthrough


Comments and/or feedback