Nav

To Create a Basic Mule App (Design Center)

This procedure shows you how to create, run, and start an app that consumes a REST service. You might want to access a web service, such as JSON Placeholder, to get information provided by the service. Creating a Mule app in Design Center to consume the service, you can access the information and do things with it. For example, you can filter the data to isolate email addresses and send email to users through the email connector. You can store the data from the service in a database and change, explore, and analyze the data using SQL. This procedure covers only the basics, not all these possibilities.

  1. Create a project:

    • Click Create create button.

    • Select Mule Application.

    • In Project Name, enter the name of the project. In this case, name the project myproject.

    • If prompted to select a Target Environment, select an environment, and click Create. Click Hide These Tips.

      New Flow opens.

  2. Select HTTP Listener from the list of triggers. In HTTP Listener - Configuration, in General, enter the following value for the required path:

    /getpath

  3. In Advanced, in Allowed Methods, enter the following method name:

    GET

    By default, all methods are allowed. It’s a best practice for security reasons to limit the methods.

    By default, CloudHub HTTP listens on a CloudHub server for an event to start the app. CloudHub HTTP appears in Reusable Configurations.

  4. Click a blank spot on the canvas to close the trigger component.

  5. Add another component, an HTTP Request:

    • Click add HTTP, search for and select HTTP Request.

    • In HTTP Request, click Edit.

      change http request configuration
    • In HTTP Request Configuration, fill in the following fields:

      • Host: jsonplaceholder.typicode.com

      • Port: 80

      • Accept the other defaults and save.

  6. In General, in Path, type the following path:

    /users

  7. Click New Flow - rename flow

  8. Select Rename, and rename the flow to Consume API.

    rename flow
  9. Run the app and execute the flow:

    • Click Run.

    • After the app is running, click options run app design env design center 2428b.

    • Select Copy Link.

    • Paste the link in a browser or client, and type /getpath at the end.

      The HTTP Listener hears the request, and starts the app. The list of JSON Placeholder users appears in the browser.

    • In Design Center, click an empty area of the canvas to close the HTTP Request component.

      Green status indicators appear in both components to indicate activity from beginning to end of the flow.

      green http listen request

Now, you can adapt this flow to dynamically change the URL of a request.

In this topic: