Quantcast
Channel: SCN : Document List - BI Platform
Viewing all articles
Browse latest Browse all 816

Simple steps to consume the Crystal Reports RESTful Web Services

$
0
0

This document provides the simple steps to consume the Crystal Reports RESTful Webservices.

Crystal Reports RESTful web services allow report data managed in a BusinessObjects Business Intelligence Platform repository to be consumed and embedded in web-enabled and mobile technology. The report content can be fetched either in XML or JSON format, and manipulate a report using the RESTful API and OData services.  RESTful web services allow you to create applications using any development language.

 

Crystal Reports RESTful web services allows to:

 

  • Export a report to a number of different file types
  • Retrieve report metadata.
  • Get rows of data and calculations.
  • Push a row of data to the report.
  • Get and set report parameters.
  • Retrieve data in XML or JSON format

          

Steps to perform the tasks are below

 

1. Logon To BOE Server

 

POSThttp://<ServerIP>:<PortNumber>/biprws/logon/long

 

Content-Type: application/xml

 

BODY :

<attrs xmlns="http://www.sap.com/rws/bip"><attr
name="userName" type="string">Administrator</attr><attr
name="password" type="string">Password1</attr><attr
name="auth" type="string"
possibilities="secEnterprise,secLDAP,secWinAD,secSAPR3">secEnterprise</attr></attrs>

 

Use token in response from now on to use this session. Put the value in a header named “X-SAP-LogonToken”.

 

2. Get Rows of the report

 

GEThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfostoreID>/rpt/data.svc/Rows

 

3. See the report’s metadata

 

GEThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/data.svc/$metadata

 

 

4. Create a transient instance(transient instance cannot be saved and the job will be cleaned up aftertime out, it can be exported)

 

GEThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/instance(this should return a list of parameters or logon required)

 

POSThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/instance

 

 

Content-Type: application/xml

 

BODY:

 

Fill in the form provided by the GET method

 

5. Access the transient instance (use the link provided in #4’s response)

 

GET http://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/<instanceID>

 

e.g.

GEThttp://<ServerIP:PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/aZmbHgQz1CSVBXMDhSMiUyRUNyeXN0YWxSZXBvcnRzQ2FjaGVTZXJ2ZXImTD1lbi1VUyZSPTY5NDgmVT0wJkU9MCZQPWVuJkk9Z01BSHV1S2pKbjBMZVMxb3ExVDFJTFpRJlQ9TkhM

 

 

6. Get the count of Number of rows

 

GEThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/<instanceID>/data.svc/Rows/$count

(example: 394 Rows my report)

 

7. POST a new row into the transient instance

 

POSThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/<instanceID>/data.svc/Rows

 

Content-Type: application/xml

 

 

BODY: (e.g.)

 

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<entry xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"

      xmlns="http://www.w3.org/2005/Atom">

<content type="application/xml">

<m:properties> 
<d:Nhl_Countries_Country>TESTCountry</d:Nhl_Countries_Country>      
<d:Nhl_Player_Info_Player_Name>TESTPlayerName</d:Nhl_Player_Info_Player_Name>

</m:properties>

</content>

</entry>

 

8. Find the new row

 

GEThttp://<ServerIP>:<PortNumber>/biprws/infostore/<ReportInfoStoreID>/rpt/<instanceID>/data.svc/Rows

 

You should see the new row added

 

The following are the list of the placeholder items description that are used in the above steps

 

  • ServerIP: Server IP of the Rest API deployed
  • PortNumber : Default Port number for web services is: 6405
  • ReportInfoStoreID: Infostore ID of the report
  • instanceID: Instance ID of the Report

            

Sample Code snippet:

 

<head>

<scriptsrc="http://BOEServerIP:Portnumber/clientapi/CR/ViewerSeed.js">

</script>

<script>

   var token = null;

   function init(){

  token = "CMSName:CMSPort@3&2=6370,U3&2v=CMSName:CMSPort,UP&66=60,U3&68=secEnterprise:BOEUsername,UP&S9=12,U3&qe=100,U3&vz=VO_bkrpzqQtPJHal6deHWH5z8QDdFGKOFI32PP.L31w,UP}";

  SAP.CR.Viewer.create("crystalViewer", 'viewerContainer1', onViewerInit,onViewerFailure);

}

 

  function onViewerInit(viewerInstance){

  viewerInstance.setReportSource(ReportID, token);

}

 

function onViewerFailure(instance, error){

  alert(error);

}

</script>

 

</head>

<style>

.viewerStyle{

   position : absolute;

   left : 12.5%;

   top : 20.5%;

    width : 75%;

    height : 75%;

}

  </style>

  <bodyonload="init()">

  <divid="viewerContainer1" class="viewerStyle"></div>

</body>

 

 

 

Hope this document helps to consume the RESTful Webservices easily.


Viewing all articles
Browse latest Browse all 816

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>