Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Sookriti_Mishra
Active Participant
1,230

Sookriti_Mishra_2-1763103908104.png

Assuming that you have enabled the API Management capability in Integration Suite, I will start with API Provider creation.

1. Create API Provider

Connection

TypeOn Premise
HostVirtual Host, as mentioned in Cloud Connector
PortVirtual Port, as mentioned in Cloud Connector
Location IDAs mentioned in Cloud Connector
AuthenticationNONE
Additional Properties:sap-client: XXX

Catalog Service Settings

Path Prefix/sap/opu/odata
Service Collection URL
/IWFND/CATALOGSERVICE;v=2/ServiceCollection
Authentication type
BASIC
Username
SAP's User Name for communication
Password
***

Test connection:Sookriti_Mishra_0-1763043320161.png

2. Create API Proxy

Select the API Provider, click on Discover to select the API which you wanted to useSookriti_Mishra_1-1763043548225.png

Select the API & then click on Create.
Sookriti_Mishra_2-1763043754144.png

3. Create Key Value Map to store the credentials to S/4HANA

Sookriti_Mishra_0-1763050329413.png

 

4. Add Policies

Sookriti_Mishra_0-1763046040766.png

Verify API Key - To verify the key which you are going to pass while calling the API.
Where do you get the API? - When you create the Product, and a Subscription, after creating a Subscription in the Developer Hub you will get a Key. That key is to be provided to the Consumer, and this Policy will verify the key sent by the consumer.

 <!--Specify in the APIKey element where to look for the variable containing the api key--> 
<VerifyAPIKey async='true' continueOnError='false' enabled='true' 
xmlns='http://www.sap.com/apimgmt'>
	<APIKey ref='request.header.apikey '/>
</VerifyAPIKey>

Key Value Map Operations - To fetch the credentials saved in the Key Value Mapping

<KeyValueMapOperations mapIdentifier="SAP_S4HANA_Credentials" async="true" continueOnError="false" enabled="true" xmlns="http://www.sap.com/apimgmt">
    <Get assignTo="private.usernameFromKVM" index="1">
        <Key>
            <Parameter>Username</Parameter>
        </Key>
    </Get>
    <Get assignTo="private.passwordFromKVM" index="1">
        <Key>
            <Parameter>Password</Parameter>
        </Key>
    </Get>
    <Scope>environment</Scope>
</KeyValueMapOperations>

Basic Authentication - To pass the credentials fetched in the previous step.

<BasicAuthentication async='true' continueOnError='false' enabled='true' xmlns='http://www.sap.com/apimgmt'>
	<Operation>Encode</Operation>
	<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
	<User ref='private.usernameFromKVM'></User>
	<Password ref='private.passwordFromKVM'></Password>
 	<AssignTo>request.header.Authorization</AssignTo>
</BasicAuthentication>

Assign Message - So you get an error as, "{"fault":{"faultstring":"Unsupported Encoding \"br\"","detail":{"errorcode":"protocol.http.UnsupportedEncoding"}}}". 
BR is a data format Brotli which is often defined by backend for webpage loading and not accepted by.... And this Assign Message will help your message reach the target.

<!-- 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="Accept-Encoding">gzip,deflate</Header>
	     </Headers> 
	</Set>
	<IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
	<AssignTo createNew="false" type="request"></AssignTo>
</AssignMessage>

5. Create Product & Add the API

Sookriti_Mishra_1-1763051389193.png

6. Create a Subscription for the Product created

Sookriti_Mishra_2-1763051447796.png

Sookriti_Mishra_3-1763051502613.png

7. It's time to test!

APIM2.jpg

Sookriti_Mishra_1-1763051977603.png

Sookriti_Mishra_2-1763052043480.png