Nav

Lab 3: Run the Mule app from Anypoint Studio

Overview

In this step we are going to test the implementation that we just finished in the previous lab. To test the API, we are going to use the Studio.

Step 1: Run the API

  1. Let’s explore the application that was just created. (we will skip the HTTP configuration since it was covered in the previous lab. The flows that were created represent the different operations available on the Customer API)

  2. To test the API, let’s run it within Studio. Right click on the application in the Package Explorer view.

  3. Select Run As​ > Mule Application​. (Feel free to skip this if you’ve done this in the previous lab)

    module3 lab3 run as
  4. Every time we start the application, we need to make sure that it is started successfully. Check in the Console tab that the project appears as "DEPLOYED".

    module3 lab3 deployed
  5. Once the application is deployed, Anypoint Studio will open a tab with the APIkit Consoles where we can test the application (to access the console, just click the link to open the Customer API Console in a browser)

    module3 lab3 api console
    module3 lab1 api console browser
  6. Click the POST tab and then click the TRY IT button

    module3 lab1 api console tryit
  7. Select the Body tab, you’ll see the request body.

    module3 lab3 api console view

Step 2: Create the User

  1. Go to the API Console.

  2. Go to the Body tab

  3. Instead of using the default json example, change the user name and email.

  4. Click the SEND button

    module3 lab3 edit post

    Once we get the successful module3_lab3_POST_successful response from the API, we can go to Salesforce and check if the customer exists.

    It could happen that you are receiving a 409 response. That means that there is a user that already exists. That is not a bad news, it means that the error handler is working right.

Step 3: Check if Customer exists

To validate that the API is working, we will login to Salesforce​.

  1. Open a browser and go to link http://salesforce.com

  2. Click on Login​ using the following credentials:

    1. Username​: mythical_read@mulesoft.com

    2. Password​: Mule13792

      The user for the login is different from the one used to config the app. This corresponds to Salesforce Security.
  3. In Salesforce, search for the existence of the email you would like to register or you already registered​.

    module3_lab3_sfdc_search

    If the user exists it will be listed.

    module3 lab3 sfdc found
  4. You can see the details by clicking on the Account Name

    module3 lab3 sfdc details
  5. Try adding another customer to further validate.

    This concludes the lab.

You can download a complete project from exchange.

Summary

In this lab, we

  • Run the Mule app from Anypoint Studio

  • Save a user in Salesforce

Go Further:

Congratulations! You have completed Lab 3.

Please proceed to Module 4