Lab 2. Complete the Process API Layer for Order Fulfillment API

Similar documents
Lab 3. Leverage Anypoint MQ to broadcast Order Fulfillment updates via Notification API

Lab 2. Connect the Order API to a SOAP Web Service

Lab 2. Implement the customer creation logic

Lab 2. Connect the Product API to a MySQL Database

Using Dropbox with Node-RED

Hosting RESTful APIs. Key Terms:

Contents. Anaplan Connector for MuleSoft

IBM Atlas Policy Distribution Administrators Guide: IER Connector. for IBM Atlas Suite v6

Lab 3. Deploy and Run the Campaigns Flow

FRM FOR OUTLOOK PLUGIN INSTALLATION GUIDE FRM Solutions, Inc.

Azure Developer Immersions API Management

Integration Guide. LoginTC

The Centrify browser extension

Tutorial. Unit: Interactive Forms Integration into Web Dynpro for Java Topic: Dynamically generated forms

DaDaDocs for Microsoft Dynamics 365 Administrator Guide

Lab 3. Publish the Omni Channel API to Exchange

Remote Desktop How to guide

SharePoint. Team Site End User Guide. Table of Contents

HOW TO BUILD YOUR FIRST ROBOT

FRM FOR OUTLOOK PLUGIN INSTALLATION GUIDE FRM Solutions, Inc.

CDC Software Platform Connector

BRIDGING THE GAP: COLLIBRA CONNECT FROM THE BUSINESS POINT OF VIEW

OneLogin Integration User Guide

Azure Developer Immersions Application Insights

Revised: 08/02/ Click the Start button at bottom left, enter Server Manager in the search box, and select it in the list to open it.

Google Sheets API Connection

MFA (Multi-Factor Authentication) Enrollment Guide

Create a Questionnaire. Triangle

Developing Intelligent Apps

Azure Archival Installation Guide

Configuring GNS3 for CCNA Security Exam (for Windows) Software Requirements to Run GNS3

Module 1: Introduction to Informatica Cloud B2B Gateway

Quick Guide to Installing and Setting Up MySQL Workbench

Installation & Configuration Guide Enterprise/Unlimited Edition

Instructor : Dr. Sunnie Chung. Independent Study Spring Pentaho. 1 P a g e

Evoq 8 Content Managers Training Manual

Lab 3. On-Premises Deployments (Optional)

TIBCO Jaspersoft running in AWS accessing a back office Oracle database via JDBC with Progress DataDirect Cloud.

IT Access Portal User Guide (Employees)

Tivoli Common Reporting V Cognos report in a Tivoli Integrated Portal dashboard

Contents. Introducing Collibra Connect 1. About Collibra Connect 2. Collibra Connect deployment 2. Installing Collibra Connect 5

Hands on Lab: Integrating Twitter with Kentico CMS

Data Science and Machine Learning Essentials

CUSTOMER PORTAL. Connectors Guide

Lab 5: Working with REST APIs

Using the JSON Iterator

Making a POST Request Using Informatica Cloud REST API Connector

NPS Apps - Google Docs Facilitated by Liza Zandonella Newtown High School May, 2013

Connecture Platform Manager

Guide to fix the problem with Problets

SAFETY TRAINING APP INSTRUCTION GUIDE Powered by. For Apple (ios) Mobile Devices

How to make a Recap Mobile Recording on ios devices

Workshare Client Extranet. Getting Started Guide. for Mac

Technical Documentation. Configuring Google SSO with Amazon AppStream 2.0 and Amazon AppStream 2.0 Chrome Packaging and Deployment

How to Install and Setup VoIPOffice Communicator for Mac

PASSPORTAL PLUGIN DOCUMENTATION

** If you are having issues logging into , Contact **

Black Box DCX3000 / DCX1000 Using the API

SAFETY TRAINING APP INSTRUCTION GUIDE Powered by. For Android Devices

Step-by-Step Guide to Set Up Your Challenge Opt-In Page with MailChimp and LeadPages (last updated August 6, 2017)

BlueMix Hands-On Workshop Lab A - Building and Deploying BlueMix Applications

Creating a REST API which exposes an existing SOAP Service with IBM API Management

Creating Dynamic Chyron Templates. (a guide)

Anaplan Connector Guide Document Version 2.1 (updated 14-MAR-2017) Document Version 2.1

Table of Contents HOL-1757-MBL-5

owncloud Android App Manual

If this is the first time you have run SSMS, I recommend setting up the startup options so that the environment is set up the way you want it.

TalkToMe: A beginner App Inventor app

Okta Integration Guide for Web Access Management with F5 BIG-IP

Documenting APIs with Swagger. TC Camp. Peter Gruenbaum

iway Integration Tools Getting Started Guide Version 8.0 and Higher

Learning vrealize Orchestrator in action V M U G L A B

Getting Started with Zentrick for Marketo

PREREQUISITES FOR EXAMPLES

S-Drive Installation Guide v1.28

Zephyr Cloud for HipChat

Purchase and Setup instructions for SWVPS (Sept 15, 2014)

PROCE55 Mobile: Web API App. Web API.

WebSphere. Clips and Tacks: Getting started with the IBM BPM suite of products

PRE-UPGRADE PREPARATION

1.1 How to Install Prerequisites

Configuring the WebDAV Folder for Adding Multiple Files to the Content Collection and Editing Them

0. Introduction On-demand. Manual Backups Full Backup Custom Backup Store Your Data Only Exclude Folders.

INSTALLATION GUIDE FOR ACPL FM220 RD WINDOWS APPLICATION INDEX

Getting Started with Community Gateway

Calendar: Scheduling, invitations, attachments, and printing

SMART Recorder. Record. Pause. Stop

Installation Guide Worksoft Analyze

Developing and Deploying vsphere Solutions, vservices, and ESX Agents. 17 APR 2018 vsphere Web Services SDK 6.7 vcenter Server 6.7 VMware ESXi 6.

Using the elab LMS Integration Tool in a Canvas Course

icontact for Salesforce Installation Guide

How to use the Assets panel

BPEL Orchestration. 4.1 Introduction. Page 1 of 31

Reading Sample. Creating New Documents and Queries Creating a Report in Web Intelligence Contents. Index. The Authors

USER GUIDE. Snow Integration Manager Version 4.3 Release date Installation Configuration Import provider settings Document date

How to Program a Mesa Tablet for a Concierge/Enterprise Site

PowerSchool Parent Portal Directions

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Installing and Configuring Respondus

Enterprise Generation Language (EGL) for IBM i operating system Create a web application using EGL and the Data Access Application Wizard

Transcription:

Lab 2 Complete the Process API Layer for Order Fulfillment API

Overview Let us now orchestrate our back-end systems to fulfill the order. We ll post the order to the Order API. The implementation will consist of a few steps 1. Extend the Order Fulfillment API stub generated from previous lab 2. Use Flow Controls such as Scatter Gather to drive the orchestration of this Process API 3. Call the Order API to create an Order. 4. Call the Customer API to retrieve user data. 5. Construct an aggregated Process API response message from System API requests using DataWeave transformations 6. Run and test the Mule app containing the Process API from Anypoint Studio Step 1: Setup the POST flow for the Process API Let s start with implementing the post:\order_fulfillment:application\json:order-fulfillment-apiconfig back-end flow. 1. Back in the flow diagram in Anypoint Studio, click on the Transform Message from the flow named post:\order_fulfillment:application\json:order-fulfillment-api-config 1

2. Remove the transform component and add a scatter gather. NOTE Scatter-Gather sends a request message to multiple targets concurrently. It collects the responses from all routes, and aggregates them into a single message. Step 2: Create a configuration file We want to allow easy configuration of the project by using configuration files. To do that we are going to create a yaml file with the configuration of the properties that are going to be used along the lab. 1. On the Menu Go to File New File 2

2. Complete the File name property with configuration.yaml NOTE Make sure that you are creating in the api-orderfulfillment/src/main/resources folder 3

3. Press Finish 4. Copy and paste the following values system: api: host: customers: mythical-customer-api-v4-0.cloudhub.io orders: mythical-order-api-v4-0.cloudhub.io NOTE One of the benefits of using YAML is that the information in a single YAML file can be easily translated to multiple language types. 5. In the api.raml file, go to the Global Elements Tab. 4

6. Press Create button 7. Filter by Configuration and select Configuration properties 5

8. Press OK 9. Complete the File property with the value configuration.yaml 6

10. Press OK Step 3: Order API - Consume Connector We ll start with calling the Order API, which is using the REST API Modeling Language (RAML) for its definition. Each time you create a RAML Spec and you publish into Exchange, a new connector is generated. We need to add this module to our project. Preview the Order API by taking a look at its API definition in Exchange. 1. Click on the Exchange Icon 7

NOTE Login with your credentials if necessary. 2. On the Organization Name, search for Order API 3. Click on the Order API and explore the API Portal 8

4. Let s look in details how the POST Method request and response body. 9

5. Click Add to project 6. A warning pop up window will appear press Proceed A window will appear telling that the import was successful. After Pressing OK, the Order API module will be ready to be used in the palette. NOTE The connector version can change. Be sure that is the last version. 7. Drag and Drop Create order from the Order API 8. Double-click on the connector to display its properties. You should see the component properties for you to configure in the Mule Properties View. 9. Click on the icon to create a new configuration as shown: 10

10. Complete the Request Configuration Host: mythical-order-api-v4-0.cloudhub.io Port: 80 Base Path: /api Protocol: HTTP NOTE Notice the Host value has the same value we configured in the configuration.yaml file for the Order API URL So we changed the value to ${system.api.host.orders} WARNING Check the protocol, by default it says HTTPS, but the service is HTTP 11. Click OK 11

12. In the General section, set the following parameters: Name Create order request data Client id Client secret Content type Accept Expression Value #[payload] 11def1b704e24d87a5ea5769772c90a7 88845E529f1F42E4a5aC96Fd504c3e01 application/json application/json The configuration should look similar to this: NOTE You can click on the and do a field by field mapping. 13. Remove the payload word from the Create order request data: box and add {}. 14. Press Refresh Metadata button. 15. Click the button. We are going to transform the messages going in and out of the RAML Consumers. 16. Map the fields from the POST call of the Order Fulfillment API to the fields required for the POST call of the Order API. Paste the following DataWeave script into the DataWeave code editor: 12

{ customerid: payload.customer_id, orderlineitems: (payload.products default []) map ( product, indexofproduct ) -> { productid: product.id, quantitysafetystock: product.quantity, quantitiyonhand: product.quantity, productname: product.productname }, status: payload.status, totalprice: payload.price as String } 17. The mapping should look like the following. 18. Press the button. We don t want to change the original payload, so we are going to save the Order Id to a variable. 19. If you are not in the Order API configuration. Focus on Order API connector. 20. Go to the Advance Tab 21. Let s complete the table with the following data: Name Target Variable Expression Value order_id 13

Name Target Value Expression Value #[payload.id] We know the output because we checked the API Spec in Exchange. You can also go to the Output tab and check in the Payload tree. NOTE 22. Search for "Business" in the component palette. 23. Drag-and-drop a Customer Business Event connector onto the canvas after the Connector component. 24. Double-click on the Customer Business Event icon to display its properties. You should see the component properties for you to configure in the Mule Properties View. 14

25. Add a meaningful name for the operation in the Display Name and the Event Name field like Order Created Event. 26. Under the Key Performance Indicators section, click on to add the following KPIs: Name Order ID Order Price Customer ID Order Status Expression Value #[vars.order_id] #[payload.price] #[payload.customer_id] #[payload.status] Step 4: Customer API - Consume Connector Next we ll call the Customer API to retrieve additional information about the customer. Again we are going to add a REST connector to our project. In this case we are going to consume the Get By ID resource. 1. Preview the Customer API by taking a look at its portal in Exchange. 15

2. Let s take a look at the response 16

3. Click Add to project button. 4. Follow the same steps you did to import the Order API Connector. At the end, the Customer API module will be ready to be used in the palette. 17

NOTE The connector version can change. Be sure that is the last version. 5. Drag and Drop Get customer by id from the Customer API connector 6. Double-click on the connector to display its properties. You should see the component properties for you to configure in the Mule Properties View. 7. Click on icon to create a new configuration as shown: 8. Define the HTTP configuration you will use with the Customer API. 9. Complete with the following values: Host: mythical-customer-api-v4-0.cloudhub.io 18

Port: 80 Base Path: /api Protocol: HTTP NOTE Notice the Host value has the same value we configured in the configuration.yaml file for the Order API URL So we changed the value to ${system.api.host.customers} 10. Click OK 11. In the General section, set the following parameters: Name Id Client id Client secret Content Type Expression Value #[payload.customer_id] 11def1b704e24d87a5ea5769772c90a7 88845E529f1F42E4a5aC96Fd504c3e01 application/json 19

Name Accept Expression Value application/json The configuration should look similar to this: 12. Finally we add a Transform Component after the Scatter-Gather to Build the API Response. 13. Double-click on the Transform Message Component 14. Pate the following Dataweave script %dw 2.0 output application/json --- { order_id: vars.order_id as Number, username: payload."1".payload.name default "" } The purpose of the lab is not to talk too much about DataWeave, but after the Scatter-Gather we are going to have a payload array. So payload."0".payload it means that you are getting values from the payload that comes from the first branch. At the end you should have a flow like this 20

Step 5: Run the API Now it s time to run the API in Anypoint Studio to see how it all works together. 1. Start the application as done in the previous Lab. (Right-click the application, Run As > Mule Application 2. Once the API Console View opens in Anypoint Studio, click on the link. 3. Under Try it, view the request body then click on the SEND button below. 21

4. Once the request is served, you should see a 200 response code and the JSON response of our API. NOTE You could get 404 Response. This means that the User ID it doesn t exist. 22

Summary In this lab, we Using Anypoint Studio, implemented the Order Fulfillment Stub to complete the Process API layer. Configured the Scatter-Gather flow control and RAML Consumer objects to orchestrate Order and Customer System APIs. Using DataWeave, managed System and API responses to produce desired result set. Tested the Process API implementation that traverses the System API layer using live API calls from RAML Consumers. Go Further: See the link Rest Connectors doc for more information See the link Scatter-Gather doc for more information See the link Dataweave doc for more information See the link Business Events doc for more information Congratulations! You have completed Lab 2. Please proceed to Lab 3 Take me to the TOP 23