Exercise: Testing APIs in the SAP API Business Hub

Objectives
After completing this lesson, you will be able to:

After completing this lesson, you will be able to:

  • Test APIs in the SAP API Business Hub

Testing APIs in the SAP API Business Hub

Description

In this exercise, you learn how to find and test the APIs in the SAP API Business Hub. We will view the available APIs for SAP S/4HANA Cloud, which can be consumed to build a side-by-side scenario.

Prerequisites

For the full execution of this exercise, you need to have the following software installed on your laptop:

SoftwareType
Google Chromeapplication
Advanced REST ClientChrome extension

Information for execution

After every step description, you can choose the [play] link to open a recorded simulation of the described actions.

Steps

  1. In Google Chrome, access the SAP API Business Hub and log on. [play]

    1. In Google Chrome, open https://api.sap.com.

    2. If you already have an account (such as, your SAP Business Technology Platform account), choose Login, enter you user and password. Accept the conditions in the Legal Disclaimers.

    3. If you don't have an account yet, choose Register and create one.

  2. Display the APIs for SAP S/4HANA Cloud. Search and display the API page for the business partner. [play]

    1. Search for business partner.

    2. Scroll down to the Business Partner (A2X) section. Choose the first api within this section, with description Perform CRUD (create, read, update, delete) operations on Business Partner, Supplier, and Customer master data in SAP S/4HANA Cloud system.

  3. Review the content of the Overview tab.

  4. Search and test the Business Partner API. Execute a GET retrieving the information of the first two business partners. [play]

    1. Switch to the Try Out tab.

    2. Go through the list of the APIs on the left side and choose Business Partner, then choose GET /A_BusinessPartner

    3. In the parameters, in the $top parameter, enter 2.

    4. Choose Run.

    5. Review the Response body.

  5. If not already available, install and run the Advanced REST Client app, from the Web location https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo?hl=en-US extension (you can find the link in the test_api_arc_install.txt file [download] ).

    1. In Google Chrome, open the Customize and control menu using the button in the top right corner of the browser. Choose More toolsExtensions. If the Advanced REST Client is already installed, just close the browser tab and proceed to the next exercise step.

    2. If the Advanced REST Client is NOT already installed, open the link just indicated in the step description.

    3. In the Advanced REST Client page, choose Add to Chrome. In the following pop-up window, choose Add app. Wait until the app is installed. A window containing all of the Google Chrome apps appears.

    4. Open the Windows Start menu, then search and open the Advanced REST client application.

    5. In ARC, skip the introductory window.

  6. In the Advanced REST Client, test the A_BusinessPartner API again. Execute a GET retrieving the information of the first two business partners. [play]

    1. In Google Chrome, access the documentation page for the Business Partner (A2X).

    2. In the header of the page, choose Show API Key.

      Note
      Note the API Key for future use in this exercise. The API Key is an identifier that replaces your user and password when you access the APIs in the SAP API Business Hub.
    3. In the Overview tab, navigate to API ResourcesConfiguration Details and note the Sandbox URL (https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER).

    4. Switch to the API Reference tab, in the list on the left, choose Business PartnerGET /A_BusinessPartner.

      Note
      Note the path suffix beside the first GET ( /A_BusinessPartner ).
    5. Observe the meaning of the first parameter named $top.

    6. In Google Chrome, choose Apps (in the top left corner), then open the ARC (Advanced REST Client) application.

    7. In the Method, enter Get.

    8. In the Request URL, enter the Sandbox URL followed by the path suffix (https://sandbox.api.sap.com/s4hanacloud/sap/opu/odata/sap/API_BUSINESS_PARTNER/A_BusinessPartner).

    9. Choose Open detailed editor (the small down arrow on the right of the Request URL).

    10. In the Param name field, enter $top.

    11. In the Param value field, enter 2.

    12. Scroll down the page, and in the Header name field, enter apikey.

    13. In the Header value, enter the API key you previously noted.

    14. Scroll up and choose the SEND button.

      Result

      The API was called and executed.
    15. Scroll down to see the return code (200 for success) and the returned XML information, including the two retrieved business partners.

Save progress to your learning plan by logging in or creating an account