RESTful Web Services are REST architecture based web services. Representational State Transfer (REST) is a style of software architecture for distributed systems such as the World Wide Web. In this architectural style, data and functionality is considered resources and are accessed using Uniform Resource Identifiers (URIs), typically links on the Web.
REST has some advantages over SOAP (Simple Objects Access Protocol) but is similar in technology since it is also a function call via HTTP protocol. REST is easier to call from various platforms, transfers pure human-readable data in JSON or XML and is faster and saves resources.
In the basic idea of REST, an object is accessed via REST, not its methods. The state of the object can be changed by the REST access. The change is caused by the passed parameters. A frequent application is the connection of the SAP PI via the REST interface.
When to use Rest Services
- You want to access BI platform repository objects or perform basic scheduling.
- You want to use a programming language that is not supported by another BI platform SDK.
- You want to extract all the query details and number of records per query for all the reports like Webi and Crystal, etc.
- You want to extract folder path of all reports at once.
RESTful Web Service Requests
To make a RESTful web service request, you need the following:
- URL – The URL that hosts the RESTful web service.
- Method – The type of HTTP method to use for sending the request, for example GET, PUT, POST, or DELETE.
- Request header – The attributes that describe the request.
- Request body – Additional information that is used to process the request.
Common RWS Error Messages
Restful Web Service URIs Summary List
|/v1||Service document that contains a link to the /infostore API.||This is the root level of an infostore resource|
|/v1/infostore||Feed contains all the objects in BOE system||/v1/infostore|
|/v1/infostore/ <object_id>||Entry corresponding to the info object with SI_ID=.||/v1/infostore/99|
|/v1/logon/long||Returns the long form for logon, which contains the user and password authentication template.||Used to logon to the BI system based on the authentication method.|
|/v1/users/ <user_id>||XML feed of user details in BOE system||You can Modify user using PUT method and DELETE user using DELETE method.|
|/v1/usergroups/ <usergroup_id>||XML feed of user group details in BOE system||Support GET and PUT and DELETE method. You can Modify user group using PUT method and DELETE user group using DELETE method.|
|v1/folders/ <folder_id>||XML feed displays the details of the folder, can be used to modify the details of the folder, and delete the folder.||You modify the folder using PUT method and DELETE the folder using DELETE method|
|/v1/publications||XML feed of all publications created in BOE system||This API supports GET method only.|
The workflow is as follows:
- To Pass the Base URL
- To Pass the Headers
- To Get the xml/json response
Automation of Rest Call
The Business Intelligence platform RESTful Web Service (BI-REST-SDK) allows you to programmatically access the BI platform functionalities such as administration, security configuration and modification of the repository. In addition, to the Business Intelligence platform RESTful web service SDK, you can also use the SAP Crystal Reports RESTful Web Services (CR REST SDK) and SAP Web Intelligence RESTful Web Services (WEBI REST SDK).
An application has been designed and implemented using Java to automate the extraction of SQL query for all the webi reports from the server at once.
- Postman (Third party application)
- Eclipse IDE
The structure of the application is as below:
The application file comprises of the required java jar files, java class files, java properties files and logs. Java class files (SqlExtract) are the source code and will be compiled and executed using command prompt as:
- Javac -cp “.;java-json.jar;json-simple-1.1.jar;log4j-1.2.17.jar” SqlExtract.java
The above command compiles the java code.
- Java -cp “.;java-json.jar;json-simple-1.1.jar;log4j-1.2.17.jar” SqlExtract.java
The above command runs the compiled java file.
The java properties file (log4j) is used to set the configurations for the java code to run. Also, the path for the log file can be set in the properties file.
The logs (SqlExtractLogger) consist of the required output file with all the extracted query for the webi reports along with the data source name, type and the row count for each query in the respective folder in the path set by the user in properties file.
The application is standalone and can run in any windows platform or server which has java JRE (version greater than 1.6 – preferred) installed in it.
Note: All the above steps required to execute the application are consolidated in the (steps) file.
SAP BO provides Restful web service to traverse through its repository, to fetch structural info and to modify the metadata structure based on the user requirements. When integrated with programming languages like python, java, etc., extends the scope to a greater extent, allowing the user to automate the workflows and to solve the backtracking problems.
Handling Restful web service needs expertise in server administration and programming as changes made to the metadata are irreversible.
About the Author –
Alan is a SAP Business Intelligence consultant with a critical thinking and an analytical mind. He believes in ‘The more extensive a man’s knowledge of what has been done, the greater will be his power of knowing what to do’.