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: 
former_member183924
Active Participant
0 Kudos

Content

  • Features
  • Download
  • Intro scenario based on ES4 Gateway service
    • Set up a new project
    • Get Service Document
    • Get Metadata with Gateway statistics
    • Read products entityset from service
    • Read a specific product ID
    • Create a new product
  • Contact

Features

  • Create HTTP requests to explore and test your HTTP API
  • Sources on Github (feel free to create a pull request)
  • Built with OpenUI5
  • Fetches CSRF-Token and automatically sets it in the header of a request (e.g. for OData post requests)
  • Run multiple request in sequences to test full CRUD scenarios
  • Assertions on HTTP header and body response to automatically validate the result of a request
  • Pre- and Post-scripts to modify almost everything with Javascript code
  • SAP Gateway statistic checks and evaluation
  • Export single request or all your projects to share them easily with your team members
  • Use projects and grouping to organize your requests
  • Support for Batch requests
  • Quickly create requests based on OData metadata
  • Run it as native Windows/Mac OS application or deploy it to your own webserver (e.g. SAP Gateway)

Download

Sources: GitHub - pensoffsky/projectX: OData Testing Tool

Download latest release for Windows and Mac: Releases · pensoffsky/projectX · GitHub

Intro scenario based on ES4 Gateway service

The ES4 Gateway service is used to give you an introduction to this OData testing tool and its capabilities.

In order to play around with ES4 Gateway service, please register first on the demo system. A detailed documentation can be found here: Sign up and get started with the SAP Gateway - Demo Consumption System

Set up a new project

  • Click on the 'Add' button with the plus sign

  • Enter project details
    • Project Name
    • Prefix URL - Endpoint of ES4 Gateway service
    • CSRF token URL - here you have the possibility to enter a different URL to fetch CSRF tokens, other than your service endpoint URL
    • activate basic authentication switch for ES4 Gateway server
    • Username - user of ES4 server
    • Password

Get Service Document

  • Enter the whole service URL into the URL input and provide a name
    • Quick tip: switch 'Use Prefix Url' on and off the put it into the URL input control
  • You can provide a Group name to group various requests in the request list on the left side

  • Click on 'Send' button (Keyboard shortcut: F7)
  • After that the response body is displayed
  • It's possible to change the output rendering to XML, JSON, HTML or plain RAW output format

  • Congratulations, your first request is live and can be extended with assertions and test

Get Metadata with Gateway statistics

  • You can enter another request for receiving Metadata document. It can be copied from Service Document request in the master list via the copy icon, therefor the group name is already set.
  • This time enter in the URL only '$metadata' and activate the switch for using Prefix URL, though you have more space in the URL input and it's more readable.

  • Add request header for 'sap-statistics' and set the value to 'true'
    • Quick tip: use Add common headers

  • After sending this request, you'll see sap-statistics HTTP header in response header with its timing information
    • Since metadata is cached in Gateway-Hub you'll see no timing data for app, gwrfcoh, gwapp nor gwnongw

Read products entityset from service

After the metadata is fetched, you can dig deeper into your service and read an entityset:

  • Copy metadata request from master list via the Copy-Button on the right



  • Adjust URL to ProductSet
  • Adjust request name and group at will
  • Click on Send button (keyboard shortcut F7)

In the received payload body you'll see all products from this entityset. Let's move on and read a single product, in this case the product ID 'HT-1000'.

Read a specific product ID

  • Copy the request from last step, add ('HT-1000') at the end of the URL and adjust name and group. The result could look like this:



  • Click on Send button
  • Check the response body

Create a new product

Now let's raise the bar a little bit and create a new product via the ES4 Gateway service.

  • Create new request via the Add button in the master list on top
  • Set HTTP method to POST
  • Set URL to ProductSet
  • Adjust name and group at will





  • Go to tab Authorization and switch option Fetch CSRF Token to ON
    If the CSRF URL is empty, you can set it up in the project settings.




  • Go to Request Headers tab and use Add common headers button to add Post Content-Type: JSON





  • Go to Payload tab and insert the following lines:

{
    "ProductID": "PX-1234",
    "TypeCode": "PR",
    "Category": "Notebooks",
    "Name": "Mac Book Pro 15",
    "NameLanguage": "EN",
    "Description": "Mac Book Pro 15“ 2,7 GHz Intel Core i7, 16GB 1600 MHz DDR3",
    "DescriptionLanguage": "EN",
    "SupplierID": "0100000001",
    "SupplierName": "Apple",
    "TaxTarifCode": 1,
    "MeasureUnit": "EA",
    "WeightMeasure": "2.200",
    "WeightUnit": "KG",
    "CurrencyCode": "EUR",
    "Price": "2200.00",
    "Width": "30.000",
    "Depth": "18.000",
    "Height": "3.000",
    "DimUnit": "CM"
}


  • The result should look like this:



  • After sending this request the receiving payload is the following, the product is created and can be retrieve with a GET request again.




Contact


This software is open source, please don't hesitate to ask questions, create issues, fork it and send us pull requests. Feedback is always welcome.

1 Comment