Nav

To Create a Basic Mule App (Design Center)

This procedure shows you how to create, deploy, 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 carefully in a real-world situation. You cannot make project name changes later. In this case, name the project myproject.

    • In Target Environment, select Design, and click Create.

      New Flow opens.

  2. Hide the tips, and click New Flow - rename flow

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

    rename flow
  4. Click Trigger, and then select HTTP Listener from the list of triggers.

  5. In HTTP Listener - Configuration, in General, enter the following value for the required path:

    /getpath

  6. In Advanced, enter the following allowed method:

    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 Connectors & Modules. You can reuse configurations in Connectors & Modules.

    cloudhub http connector in modules and connectors
  7. Click a blank spot on the canvas to close, and then add another HTTP connector:

    • Click add HTTP and select HTTP Request.

    • In HTTP Request, click Edit.

      change http request configuration
    • Configure HTTP Request as follows:

      • host: jsonplaceholder.typicode.com

      • port: 80

      • Accept the other defaults and save.

  8. In General, in Path or URL, type the following path:

    /users

  9. Click Deploy, and after the Latest Changes Deployed message appears, 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. The green status indicator appears in all parts of the flow.

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

In this topic: