Technical Articles
Building SAP UI with Salesforce data using REST Api’s
Overview:
SAP Cloud Platform is an integration and extension platform built for the Intelligent Enterprise that enables you to connect your landscape and create application extensions that focus on your business needs. This blog will help you learn and understand how can we access data from Salesforce systems using REST APIs and build our own custom applications.
What we will learn at the end of this blog –
- Accessing Salesforce trial account
- How to use Developer workbench
- Creating a connected application.
- Create Service key to access REST API’s
- Test the services in POSTMAN
- Create a UI5 application to display a list of Accounts / Service tickets.
Accessing Salesforce trial account –
Salesforce provides access to a trial account which is valid for 30 days. Please create an account by filling in the appropriate details. Please use the developer sign up link to create one.
How to use Developer workbench –
Salesforce Workbench is a highly adaptable and cloud-hosted toolkit provided to Salesforce Developers and Administrators to administer Salesforce organization using Force APIs. Using the Salesforce Workbench tool, they can easily perform Salesforce Object Query Language (SOQL) and Salesforce Object Search Language (SOSL), view their organization’s data, perform data loading and testing, deploy and troubleshoot their applications, and modify session settings.
Access Workbench with the following link – Workbench
Note – Workbench is free to use but is not an official salesforce.com product.
Create connected application –
What is a connected application?
A connected app is a framework that enables an external application to integrate with Salesforce using APIs and standard protocols, such as SAML, OAuth, and OpenID Connect. Connected apps use these protocols to authenticate, authorize, and provide single sign-on (SSO) for external apps. The external apps that are integrated with Salesforce can run on the customer success platform, other platforms, devices, or SaaS subscriptions.
To create a connected application please follow the following steps –
- Login to your Salesforce account – Link
- You can browse different applications such as Account, Service, etc. Using this link will show you the list of service tickets created.
- Please navigate to the following path to create a connected application or alternatively you can use direct link. Settings-> Service setup – > User Interface- >App Manager -> New connected app
Fill in the appropriate details for the connected application which you need to create. There are a few important fields that you need to fill correctly.
- Enable API (Enable OAuth Settings)
- Callback URL – https://login.salesforce.com/services/oauth2/token
- Selected OAuth scopes – You can select all or as per your requirement.
- Finally, Save the application.
- Please save the Consumer Key and consumer secret in a notepad which will be needing soon while accessing the API’s.
- After the application is successfully created we need to change OAuth policies so that all users can self-authorize while accessing the APIs.
- We will be using client credentials to generate an access token and with client credentials i.e username/password we all need to pass the Security token appended to the password. Follow the steps shown in the below images to access the security token.
Before we proceed further please make note of the following fields which we were able to create using the steps mentioned above –
- Consumer Key
- Consumer secret
- Security Token
- User Credentials
Test the services in POSTMAN
Download the full set of API collection from the Git link and import to your REST client (POSTMAN which I will be using for this test). After importing this you can set up your environment variable and fill in _endpoint and version. You can use the API version as per your choice which you can decide upon after going through the rest API developer guide mentioned in the reference links of this blog. I will be using version 20 for testing the api’s (Check developer workbench for different api’s versions available ). The following steps show you how to fetch access tokens which will be passing in while accessing the API’s.
Authentication – The Lightning Platform REST API supports OAuth 2.0 (an open protocol to allow secure API authorization). See Authorize Apps with OAuth in the Salesforce Help for more details.
Will take an example to fetch the list of accounts from Object Accounts in Salesforce.
Endpoint – https://ap16.salesforce.com/services/data/v20.0/sobjects/account/
Authorization Bearer {{TOKEN FROM the LAST STEP}}
After successful authentication, this will return a list of account present in the system, Feel free to play around with different objects (Accounts, Cases). To check different object available use the following API – https://ap16.salesforce.com/services/data/v20.0/sobjects/
Create a UI5 application to display a list of Accounts / Service tickets.
We will not cover all the steps on how to build a UI5 application rather I will show the destination configuration on SAP Cloud Platform which you need to create. Please check the below image and create one with your credentials. (Make sure you suffix security token with password as you did while testing in POSTMAN).
Log in to your SAP Cloud Platform account and select the respective sub-account where you want to build the application.
Using the destination created you will be able to fetch the data ad build your custom UI5 application. Following are the 2 examples where we were able to list accounts and cases from the Salesforce systems.
![]() |
![]() |
So we have successfully fetched the data from Salesforce systems and able to build the custom web applications using SAP UI5. I hope you found it interesting and would like to give a try 🙂
Please do drop in your thoughts in the comments section. Thank you !!
Reference Links –
- https://help.salesforce.com/articleView?id=connected_app_overview.htm&type=5
- REST API developer guide – https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/quickstart_oauth.htm
- https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_sobject_basic_info.htm
- https://help.salesforce.com/articleView?id=remoteaccess_authenticate.htm&language=en_US
This is a great read Jay, I'd like to know if these steps change using Open Connectors, what the differences are when using Open Connectors to create the connectivity. Look forward to seeing more from you!
Nic, thank you for your feedback. Using an open connector is very simple we don't need to have all these steps done. This blog will help to understand what happens underneath and if you want to consume directly will help you. I will try to put the steps to achieve the same using open connector and how OC make life easy.
Very nice blog - thanks for sharing!