Contact Free trial Login

To Consume a REST Service (Studio)

You can design an app to consume a REST service by setting up HTTP Listener and Request operations. In this procedure, you first consume a REST API service using primarily default HTTP configurations. Next, you test the HTTP request. You edit the configuration to make a secure HTTPS request. Finally, you test the HTTPS request.

  1. From the Mule Palette, drag an HTTP Listener operation to a new flow.

  2. Set up the Listener configuration: Click + and set the default host, port and base path. For example, host = 0.0.0.0, port = 8081, and no base path.

  3. In General, set Path to /trigger.

  4. Accept the other default Listener settings, and save the configuration.

  5. From Mule Palette, drag an HTTP Request operation to the flow.

  6. Set up the Request configuration:

    • Set URL Or Path to http://jsonplaceholder.typicode.com/users.

    • Accept the other default settings and save.

  7. Deploy the app. Open a browser, and go to localhost:8081/trigger.

    The Listener hears the request on port 8081, and starts the app. The list of users appears in the browser.

  8. Change the Request configuration to use HTTPS protocol.

    • Set URL Or Path to https://jsonplaceholder.typicode.com/users.

    • Set the port to 443.

    • Accept the other default settings and save.

  9. Deploy the app, run the app, open a browser, and go to localhost:8081/trigger.

    The Listener hears the request on port 8081, and starts the app. The list of users appears in the browser.

See Also

  • About the HTTP Request Operation

  • About HTTP Connector Migration

  • HTTP Connector Reference

  • HTTP Connector Documentation Reference

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.