Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
divyamary
Contributor
SAP API Business Hub is the central catalog of all SAP and partner APIs for developers to build sample apps, extensions and open integrations with SAP.   SAP applications, platforms, and business networks continue to open up through APIs – to facilitate ecosystem-driven innovations and seamless integration – through the SAP API Business Hub.

In the 5 part blog series, Discover, Explore and Consume of SAP S/4 HANA Cloud APIs from SAP API Business Hub and Manage of SAP S/4 HANA Cloud APIs from SAP Cloud Platform API Management was covered. In this blog, we would be showcasing Discover, Explore, Consume and Manage of SAP Hybris Cloud for Customer API (Opportunity) from SAP API Business Hub and SAP Cloud Platform API Management.

Discover and Explore APIs in SAP API Business Hub



  • Easily search for all SAP Hybris Cloud for Customer APIs in SAP API Business Hub.






 

  • Click on any of the SAP Hybris Cloud for Customer OData API or  API Packages from the search results to explore APIs in details. In this blog we would be exploring the APIs from SAP Hybris Cloud for Customer - OData API Package.




 

  • Explore, Test Opportunity Entity Type API to view all the Opportunities and potential sales from SAP Hybris Cloud for Customer. Detailed steps covered in this blog.




 

More details of Opportunity Entity Type available in help documentation.  The picture below provides a view of the various entities available in the Opportunity API.



 

  • Select the leading OpportunityCollection resources to view all Opportunities from the SAP Hybris Cloud for Customer API Sandbox.




 

 



 

 

 



 



 

Build Fiori application in SAP Cloud Platform Web IDE


SAP Cloud Platform Web IDE is a powerful, web-based integrated development tool that simplifies end-to-end application development and enables developers to quickly discover APIs from SAP API Business Hub to generate Fiori applications.

Once the SAP Hybris Cloud for Customer - Opportunity Entity Type API has been explored and tested from SAP API Business Hub, we can consume this API to build a Fiori application in SAP Cloud Platform Web IDE. Ref this blog for detailed steps.

  • Open Full Stack Cloud Platform Web IDE. Create a new SAP Fiori Master-Detail Application named say MyOpportunities.




 



 



 

  • Select SAP API Business Hub as the source and SAP Hybris Cloud for Customer Package from the API Package drop down and select Opportunity API.




 

  • Enter the following properties in the Template Customization screen and then click Finish to generate the Fiori Application.













































































Settings



Property Name



Property Value



Application Settings



Type



Standalone App





Title



My Opportunities





Namespace



com.c4c.demo





Description



My Sales opportunities and potential sales



Data Binding – Object



Object Collection



OpportunityCollection





Object Collection ID



ObjectID





Object Title



AccountName/content





Object Numeric Attribute



TotalNegotiatedValue/content



Data Binding - Line Item



Line Item Collection



OpportunityProduct





Line Item Collection ID



ObjectID





Line Item Title



Description/content





Line Item Numeric Attribute



ProposedValue/content





Line Item Unit of Measure



ProposedValue/currencyCode




 



 

 



 

 



 

  • Click on Run/Play to launch the MyOpportunities Fiori applications


 



 



 

Manage in SAP Cloud Platform API Management


SAP Cloud Platform API Management is an integral of an architecture blueprint when it comes to development of digital applications. SAP Cloud Platform API Management can handle any HTTP(S) based API (REST/ OData/ SOAP) both SAP and Non SAP APIs.  From the Discover tab, you can discover all SAP Cloud applications API including SAP Hybris Cloud for Customer and also select Partner APIs.

Ref this blog for detailed steps.

  • Open SAP Cloud Platform API Management API Portal. Navigate to the Discover from the hamburger icon




 

  • Click on ALL and then type in c4c in the search field to view all SAP Hybris Cloud for Customer APIs. Click on SAP Hybris Cloud for Customer - OData API Package from the search result.


 



 

  • Select Opportunity Entity Type API by navigating to the ARTIFACTS tab. Click on Copy to copy the Opportunity API into SAP Cloud Platform API Management tenant and connect it to your own SAP Hybris Cloud for Customer tenant.




  • In the tenantname provide your SAP Hybris Cloud for Customer tenant name, Change the API Proxy Name, Title, base path if required and then click OK.


 



  • API Proxy is created by default in Undeployed state. Select newly created C4C_Opportunity API Proxy.




 

  • Note there is an issue with the copied target details for SAP Hybris Cloud for Customer OData API endpoint and therefore select TARGET ENDPOINT tab to correct the endpoint details by removing /c4c/ path from the generated URL ( the correct URL pattern is https://{tenantname}.crm.ondemand.com/sap/byd/odata/v1/c4codata)




 

  • Click on Save to persist changes to the target endpoint.




 

  • Whenever there is change in the target endpoint a confirmation dialog would be shown. Click on Yes to confirm the changes.




 

  • Since the API Proxy is still in the Undeployed or in active state, click on Deploy as shown in the screenshot to activate the C4C_Opportunity API Proxy




 

  • Select RESOURCES tab and click on GET operation view all Opportunities from your SAP Hybris Cloud for Customer tenant. In the Test Console, enter your user credentials to SAP Hybris Cloud for Customer tenant and click on Send.




 



 



 

 

Connect Fiori application to SAP Cloud Platform API Management API Proxy


To connect generated Fiori application to the SAP Cloud Platform API Management managed User Management APIs, a destination to the API Proxy host would be required.

Ref this blog for detailed steps.

  • Navigate to your SAP Cloud Platform Cockpit.

  • Click on Destinations tab under Connectivity. Click on New Destinations to create destination to the API Proxy endpoint. Enter Name as myC4c, URL as the API Proxy endpoint and select Authentication as Basic Authentication and enter your SAP Hybris Cloud for Customer tenant credentials.




  • Enter additional property named WebIDEUsage with value set to true so that this Destination configuration can be used from SAP Cloud Platform Web IDE. Click on Save to persist the changes.



















Name


myc4c

URL



https://your_api_management_proxy_host/



Authentication



BasicAuthentication




 



 

  • Expand the generated MyOpportunities Fiori application from SAP Cloud Platform Web IDE.

  • Click on manifest.json file from the expanded project in WorkSpace explorer and change the mainService datasource to remove the /apihub_sandbox from the uri.


 



 



 

  • Click on neo-app.json from the expanded project in WorkSpace explorer and change the /apihub_sandbox path , target type application of the generated code.




 

  • Change path from /apihub_sandbox to /c4c, target type from application to destination, name from webidecp to myc4c( destination name as specified in the section Destination to SAP Cloud Platform API Management section), entryPath from /destinations/apihub_sandbox to /c4c.




 

 

  • Click on Run/Play to launch the MyOpportunities Fiori applications connecting to the SAP API Cloud Platform Managed Opportunity Entity Type API.




 



 

Monitor application usage via SAP Cloud Platform API Management


With the Fiori application connected via SAP Cloud Platform API Management to your SAP Hybris Cloud for Customer APIs, usage of the Opportunity API can be monitored and governed by SAP Cloud Platform API Management.

 



 



 

SAP Cloud Platform, API Management also offers many out of the box API Security best practices which includes security policies for Authentication and Authorization, Traffic Management and many more.

Further Reads



  • API Security Best Practices blog series.

  • Monitor and Analytics blog.

  • Enchanced developer experience blog.


For more blogs on SAP Cloud Platform API Management visit us at SAP Community
1 Comment