Connect to Microservices using the API Proxy

API Proxy

When connecting to the enterprise backend, it is possible to leverage the security and analytics of Persistent Mobile Foundation platform using the API Proxy. As the name suggests, it is a proxy that can be used to proxy over the requests to the actual backend.

Some of the Advantages of using the API Proxy

  • The actual backend host is not exposed to the mobile app and stays secure in Persistent Mobile Foundation server.
  • Get the analytics of the requests that are made to the backend

How to use the API Proxy?

  1. Download the Mobile API Proxy adapter from the PMF Console.

    API Proxy

  2. Deploy the API Proxy adapter to PMF server.

  3. Configure the backend URI in the API Proxy adapter configuration. The URI should be of the format protocol:host:port/context. For example, http://secure-backend/basecontext/.
  4. Make the requests to the backend using the WLResourceRequest API. Use the API call code snippet from the MOBILE CORE section. Alter the options object to set useAPIProxy key to true.

    Example:

     var resourceRequest = new WLResourceRequest(
         "weather/city/Miami",
         WLResourceRequest.GET,
         { "useAPIProxy": true }
     );
     resourceRequest.send().then(
         function(response) {
             alert("Success: " + response.responseText);
         },
         function(response) {
             alert("Failure: " + JSON.stringify(response));
         }
     );
    
Last modified on