Friday, 19 June 2020

Access Microsoft Outlook email using Outlook Version 2.0 API


Summary:
This blog demonstrates the steps involved to access Microsoft Outlook email using Outlook Version 2.0 API's.


Use Case:
If you are a application developer then often there might be at times requirement to read email messages or the email attachments send to a particular account user. So, how could you achieve this? There are many approaches for this but the most simple one is to make use of Microsoft's Outlook Version 2.0 API's.

Assumption:
1. Office 365 or School or outlook account is a must.


Let's begin the demonstration...
First of all in order to access emails via API's we must register application on azure portal and then provide appropriate access for the application/ client and then access emails using REST API's.

App registration on Azure portal
Step 1:  Login to azure portal (link)

Step 2: Click on "Portal" as shown below 




Step 3: On search bar, search for "App registrations" as shown below





Step 4: Click on "New registration" button




Step 5: Fill the Application registration form as shown below

Redirect URI is optional here and the URL must be unique to the environment from where the API's are being called from.

Example: Callback URL for postman client is https://app.getpostman.com/oauth2/callback



Click on "Register" button once done.

NOTE:
1. For School or Office 365 accounts use account type as option 1. 
2. For outlook personal account select account type as option 2.


Step 6: Note down the Application or Client ID from the Overview page





Step 7: Click on "Certificates & secrets"




Step 8: Click on "New client secret"





Step 9: Fill the form as per your requirement



Click on "Add" button


Step 10: Copy the secret generated as this will be only visible at the time of creation of secret




Step 11: Click on "API permission" from the menu and then click on "Add a permission" button




Step 12: Click on "Microsoft Graph" -> "Delegated permissions" -> select "email" -> "Add permissions"




We are done with the "App registration" on Azure.


Testing Outlook API's using POSTMAN:

Step 1: I'll use API to list all the folders in my outlook email account as shown below

Method: GET
URL: https://outlook.office.com/api/v2.0/me/MailFolders
Authorization Type: OAuth 2.0


Click on "Get New Access Token"



Step 2: Fill the details relevant to your Azure app created in above steps in the OAuth 2.0 form

Click on "Request Token" -> sign in with your outlook account in next screen
Click on "Use Token"

Step 3:  Click on "Send" button



Hope this blog helped you with the procedure to register app on Azure and consume outlook API's. .

Let me know in comments section for any queries.


Know Yourself Blogs...


Saturday, 2 May 2020

Import OIC Integration or .iar file into the JDeveloper IDE

Summary:
In this blog i'm going to explain the procedure to import Oracle Integration Cloud (OIC) - Integrations project or .iar file into the Oracle JDeveloper IDE.

Importing .iar file into JDeveloper will be useful for someone who has extensive experience working in JDeveloper IDE especially for XSLT coding and someone who is not comfortable working on XSLT in notepad or on OIC browser based IDE for mappings.

Assumption:
1. OIC instance already configured in Oracle Cloud and the environment should be up and running
2. Integration is already built and available for export. If not refer here to create one.
3. JDeveloper IDE is already installed in computer.

Steps:
1. Export any Integration from OIC instance with the help of below navigation.
      i.   Click on Designer from the Integrations home menu
      ii.  Click on Integrations from the Designer menu
      iii.  Select the Integration to be exported and then click on export from the menu as shown below
 
.iar file will now be downloaded to your local computer.

2. Open JDeveloper and create one Service bus application as shown below
   

3. Now create one service bus project within the application created in earlier step as shown below


4.
Now import the .iar file downloaded earlier in to the service bus project using below navigation
File-> Import -> Service bus resources



5. In the next window click on magnifier lens icon in front of zip source and select the .iar file as shown below
Click Next and then Finish.

6. The .iar file will now be imported into the JDeveloper IDE as shown below. 


Hope this blog helped you with importing .iar file or Integrations into the Oracle JDeveloper IDE. 

Let me know in comments section for any queries.


Know Yourself Blogs...

Create REST Web Service using Oracle Integration Cloud (OIC) - Integrations

Summary:
In this blog i'm going to explain the procedure to create REST web service in Oracle Integration Cloud (Integrations) which will be used to expose the integration as a web service to external consumers.

We are going to create a web service in this blog which will accept first name and second name of user and output will be greeting as described below

INPUT      :  <first name> 
                    <second name>
OUTPUT  :  Hello <first name  second name>

HTTP Method: POST

Assumption:
1. OIC instance already configured in Oracle Cloud and the environment should be up and running
2. Login user has at- least developer privilege for OIC.


Let's begin by first creating a Trigger REST connection

Steps to Create REST Connection as Trigger:
1. Goto Connections page in OIC integration with the help of below navigation.
      a.  Login to OIC instance   (e.g:  <host:port>/ic/home/)
      b.  Click on Integrations from the home menu (i.e. if landed on to OIC homepage post login)
      c.  Click on Designer from the integration menu
      c.  Click on Connection from the Designer menu
      d.  Click on Create button as shown below


2. Search for REST in the search bar and select the REST adapter or connection as shown below
  

3. Give the connection name, identifier, role and description in the window for REST connection creation as shown below and then click on 'create' button.

   


 Below are few points to be noted about the connection parameters
         i. Name: 
             This can be any name suitable for project or any project specific identifier.
         ii. Identifier: 
             This field value is auto generated by OIC and is used as a reference for integration while consuming it during integration development or could be used for uniquely identifying the connection while using OIC API's for connections.
         iii. Role: 
            Trigger is used when the connection is used as entry point for integration or for the external consumers to consume the service built. 
            Invoke is used if the integration consuming this connection want to communicate with external SOAP web services or references.
            Trigger and Invoke is used if the connection is used both as a entry point as well as a reference for invoking SOAP web services.

4. In next screen click on 'Test' and 'Save' button and then close the connection page
   

We have now successfully created REST connection as Trigger to consume in our integration. 

Let's now build our web service

Steps to Create Integration to expose as a REST web service:
1. Goto Connections page in OIC integration with the help of below navigation.
      i.   Click on Designer from the integration menu
      ii.  Click on Integration from the Designer menu
      iii.  Click on Create button as shown below

2. In the pop up window fill the Name for integration, Description, Version, Keyword and Package details if any and then click on Create button  

3. Click on the '+' icon at the top of screen and select the trigger connection which we created in earlier steps
    


4. In the pop up screen give some meaningful name for the connection and then click on next 


5. Fill the details for 'resource URI', select http method to POST under action, select check boxes to configure request and response payload for the endpoint and then click on Next button
   

6. Select the request payload format to JSON from the list of values/ drop down and then click on inline as shown below
   

7. Paste the sample JSON request payload as shown below and click on OK button
   

8.  Select the response payload format to JSON from the list of values/ drop down and then click on inline as shown below
   

9. Paste the sample JSON response payload as shown below and click on OK button

10. Then keep everything to default and click next -> done.
11. The flow will look similar to as shown in below screenshot 
    

12. Click on 'Map' activity in the flow and map output as concatenation of Hello, First name and Second Name
   


13. Update Tracking variable and Activate the integration. 
    Updating tracking variable and activating integration is described here
   
14. Copy the resource URL and test the service from Postman or any of your preferred testing tool and validate the service built as shown below



Hope this blog helped you in building REST Web Service using Oracle Integration Cloud. 

Let me know in comments section for any queries.


Know Yourself Blogs...

Friday, 1 May 2020

Create SOAP Web Service using Oracle Integration Cloud (OIC) - Integrations

Summary:
In this blog i'm going to explain the procedure to create SOAP web service using Oracle Integration Cloud - Integrations (ICS). In practical scenario such SOAP based web services are useful if the underlying interfaces need to be exposed as a service to consumers over http, i.e. for example if the database table or stored procedure or function need to be exposed as a service then this could be achieved using Integrations.

We are going to create a SOAP web service in this blog which will accept first name and second name of user and output will be greeting as described below

INPUT      :  <first name> 
                    <second name>
OUTPUT  :  Hello <first name  second name>


Assumption:
1. OIC instance already configured in Oracle Cloud and the environment should be up and running
2. Login user has at- least developer privilege for OIC.
3. SOAP trigger connection is already created and available. (Refer here for connection creation)


Steps:
1. Goto 'Integrations' page in Oracle Integration Cloud with the help of below navigation.
      a.  Login to OIC instance   (e.g:  <host:port>/ic/home/)
      b.  Click on Integrations from the home menu (i.e. if landed on to OIC homepage post login)
      c.  Click on 'Designer' from the menu
      d.  Click on 'Integrations' from the menu

2. Click on Create button on the right top corner of the screen as shown below
    


3. Select 'App Driven Orchestration' from the popup screen as shown below and then click on 'select' button
   


4. Give meaningful 'Name' for integration, 'Identifier' (auto populated by OIC), 'Version' (as per versioning need of project), 'Description' (In short summary of what integration does) and 'Package' (it is like to bundle all the integrations related to one module under one tree or package i.e. similar  to creating partition in Oracle SOA) as shown below

5. Click on the '+' icon at the top of screen and select the trigger connection which will be used to expose the integration as SOAP web service as shown below
   


6. In the pop up screen give some meaningful name for the connection and then click on next -> next -> Done
   

7. The flow will look similar to as shown in below screenshot 
    


8. Click on 'Map' activity in the flow and map output as concatenation of Hello, First name and Second Name
   


9. Click on the hamburger menu on the right top corner of the screen and select 'Tracking' as shown below
   


10. Map first name to tracking 1 and second name to tracking 2 variables as shown below  (Those variable are used as sensors for monitoring any transactions)
   
11. Click on save and close the Integration page.
12. Drag the toggle switch towards right in order to 'Activate' the integration
    

13. Click on 'Activate' button as shown below 


14. Wait for 10 seconds and refresh the integration layout. The WSDL URL for the web service is obtained by clicking on the icon as shown below
   

15. Copy the WSDL URL and test the service from SOAP UI or any of your preferred tool and validate the service built as shown below
    



Hope this blog helped you in building SOAP Web Service using Oracle Integration Cloud. 
Let me know in comments section for any queries.


Know Yourself Blogs...



Access Microsoft Outlook email using Outlook Version 2.0 API

Summary: This blog demonstrates the steps involved to access Microsoft Outlook email using Outlook Version 2.0 API's. Use Cas...