Hi guys, next PART01, in this article I want to share one scenario which required from my co-worker. He wants to connect to Outlook mailbox and get information attachment with format PDF and after that extract data in it, and send to backend by ABAP Program.
To resolve this requirement, I will use API Management connect to partner API by using OPEN Connector. Outlook 365 provides a collection API which help us get information of mailbox.
Because this is series which discuss about API Management, so I want to use APIM to connect to API Outlook through Open Connector. You also use Cloud Integration (iFlow) to connect to api outlook by using request reply component and open connector receiver adapter. No Problem.
CREATE INSTANCE OUTLOOK 365 IN OPEN CONNECTOR
Login to SAP BTP Cockpit and go to Integration Suite Application
Test API on Open Connector
Test API on POSTMAN
To test API on external tool, example POSTMAN, you have to get 3 informations
After that, collect these informations and assign it into header with key is AUTHORIZATION and value is User <User Secret>, Organization <Organization Secret>, Element <Instance Token>
OK, this section, we created instance on Open Connect. Next, we will create and configure APIM to consume this instance.
You also configure integration flow (Cloud Integration) to consume this instance by using request reply component with Open connector receiver adapter. No problem.
CONFIGURATION APIM TO CONSUME INSTANCE OUTLOOK ON OPEN CONNECTOR
Create API URL
This time, we test API we will receive 401 – Unauthorized http status code. Because we not set header for this API
Set header for API by using Policy named Assign Message.
Create and configure policy Assign Message for target API
<!-- This policy can be used to create or modify the standard HTTP request and response messages --> <AssignMessage async="false" continueOnError="false" enabled="true" xmlns='http://www.sap.com/apimgmt'> <!-- Sets a new value to the existing parameter --> <Set> <Headers> <Header name="Authorization">User XXXXX, Organization XXXX, Element XXXX</Header> </Headers> </Set> <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables> <AssignTo createNew="false" type="request">request</AssignTo> </AssignMessage>
Save and deploy. TEST again
In this article, I shared my understand How to working with APIM to connect to OUTLOOK 365 by open connector. In this, I also shared how to use policy which named ASSIGN MESSAGE to set header for request before call API. Thanks for your reading and any advise, kindly leave your comment on this.