SpagoBI – Exporting and Importing Report Documents

Step-by-step instructions for Exporting a report document from one server and importing into others.


  • In the source SpagoBI Environment, go to Import/Export
  • Then, select the documents you want to export.


  • Name the export (20 character limit?)
    • ex:  2015-12-30-scheduled-cand
  • Then, press the export icon


  • When the “Download” link appears, click it


  • Now, You’ve now got a zip file (in downloads) containing the two reports and meta-data about them.  Sign out of POC / DEV
  • This file must have the exact same name when you import into another SpagoBI Environment.  The zip file of the exported document can now be imported into multiple SpagoBI target environments.
  • Next, sign into the Destination SpagoBI server
  • Go to Import / Export again


  • “In Import” , click on “Choose file”


  • Select the file
  • Press the Open button
  • The file name should show. Click on the Import icon


Roles and associations

  • Visually verify that all roles map correctly
  • Click on next



Engine Associations

  • For each Engine, carefully select the corresponding engine it maps to in the target spagobi environment
  • Most of the time,   We’re mapping the Birt report engine to the Birt Report Engine
  • Click on Next


Data Source Associations

  • For each Data Source (exported), carefully map it to the data source in the target SpagoBI Environment
  • In most cases, the names should match exactly.  If they don’t match, you may have a problem.   The below screenshot is probably not so helpful.


Metadata conflicts

  • Review all of the List of Value mappings, Functionality Mappings, and other data
  • Make sure you really want to do this before you proceed
  • Select “Yes”  for “Overwrite the existing meta-data with the exported one?”
    Note: This will overwrite  LOVs, ADs, and these reports in the target tenant. Are you sure you want to do this?


  • Click on next
  • Download the log file


  • Keep a copy of the log file and review it to make sure it really deployed what you think it did
  • Go to reports (in spago)
  • Navigate to the reports you just deployed


Interested in Automated Deployments of an Exported Document?

Would you be interested in programmatically deploying an exported SpagoBI document to other SpagoBI environments?

SpagoBI 5.2 REST DataSets with JSON Data


SpagoBI 5.2 introduces a new dataset type :  RESTful web service datasets . This allows SpagoBI to report on data from sources other than databases with JDBC drivers.

What follows is an end-to-end demonstration of creating and using a REST (JSON) Dataset in SpagoBI 5.2.

External documentation

Description URL
SpagoBI 5.2  NGSI usage of REST Data Sets
SpagoBI 5.2 Documentation
SpagoBI 5.2 Release Notes

Limitations in REST Data Sets

  1. The response of the REST service must be a JSON object.
  2. If the outermost JSON element is an array, it will not work.
    1. There is an assertion that checks that the RESTful call returns a JSON Object.
    2. According to SpagoBI support this is a security feature, not a bug.
    3. However, that means that not all RESTful web services can be used by the SpagoBI REST Dataset. If you’re designing the RESTful web service, that may be fine for you.  If you’re trying to consume a pre-existing RESTful web service, this could be a problem.
  3. “The JSON response must return a flat data structure: SpagoBI cannot handle nested structures”, per SpagoBI Support. (Update 2016-06-22)

Still TBD – DataSet record number limitations

  1. How large or complex of a JSON response can SpagoBI handle?
    1. Per SpagoBI Support, they say they’ve successfully experimented REST Data Sets containing 40,000 records.
    2. Pending experimentation on my part.
      1. I previously attempted record sets with 100 (4MB data), 500 (22 MB data), 1000 (44 MB data), and 5000 records. The JSON was complex and most certainly not flat.
      2. I was able to retrieve the outermost, flat values correctly for the recordsets with 100 and 500 entries.
      3. My experimental recordsets failed processing in setting up the REST Data Set with 1000 or more records.

Example Implementation

Setting up the REST Data Set

Understand the structure of the response for the REST web service you want to use.  Make sure it matches with the limitations above.

Example JSON response

        "data" : [
                {"id" : "1", "title" : "this is just a test"},
                {"id" : "2", "title" : "second record"}

In SpagoBI 5.2 (or later)

  • Go to Data Sets
  • Define a new Data Set
  • Set as follows
    • DataSet Type:
      • REST
    • Request Body:
      • if required
    • HTTP Method:
      • Post, Get, Put, or Delete.
      • In this example, use Get
    • JSON Path:
      • Must be a valid JSON Path expression
      • In this example,  we want all JSON objects in the data array
      • Use :  $.data[*]
    • JSON Path Attributes
      • See JSON Path reference
      • See screenshot below
        image2016-6-16 11-34-29

image2016-6-16 11-30-34


Click Preview. If everything worked right, you should get back the expected columns and rows.

image2016-6-16 11-35-45

Using the SpagoBI REST Data Set in a Report Document

Now, it is time to use the SpagoBI REST Data set in a Report Document.  For the sake of ease, let’s create a BIRT report in SpagoBI Studio.

In report design view

  • Go to the outline palette
  • Create a new Data Source reference
    • Data Source Type:  select “SpagoBI Server Data Source”
    • Provide the following details
      • Server URL  (Use the dns name or IP of your SpagoBI 5.2 (or later) server
      • user name and password
        image2016-6-16 11-39-50
      • Create a Data Set
        • Data Set Type:   “SpagoBI Server Data Set”
        • Data Set Name:  example: “DS_Z_Rest_04 Data Set”
          <a href="https://www.davidbharrison find”>image2016-6-16 11-42-37
        • Next
          • Enter the Dataset Label (from SpagoBI).  It must be an exact match with the Data Set label we defined earlier, in SpagoBI server.
            • ex:  DS_Z_Rest_04
              image2016-6-16 11-45-8
          • Now, the output columns should show the columns defined in the data set
            image2016-6-16 11-46-28
  • Now, you’re free to use the data set in the report. In the example below, I’ve defined a 2 column table, associated with the data set. Each column is used.
    image2016-6-16 11-47-35
  • Let’s preview the report
    image2016-6-16 11-47-57
  • Deploy it to SpagoBI Server and run it
    • Other tutorials I’ve provided go into detail on how to deploy and configure reports
  • Run it in SpagoBI Server
    • Default view in SpagoBI execute document
      image2016-6-16 11-49-26
    • Generate a PDFimage2016-6-16 11-50-12




SpagoBI DataSet REST Webservice via Groovy

SpagoBI DataSet REST Webservice via Groovy

Per SpagoBI Support, Groovy cannot be used in a script-based Dataset to provide rows of data. According to the last support ticket, there is no intent to make that work.

Groovy Data Set to make RESTful web service call and return IP Address related information in SpagoBI’s XML format

Prerequisites :

  1. Upgrade Groovy in SpagoBI and Drop in a copy of the WSLite library
    1. See Upgrading Groovy in SpagoBI
    2. See SpagoBI DataSet SOAP Webservice via Groovy
  2. Restart SpagoBI

Create a new SpagoBI Data Set


For the Type, Specify Script
For the Script Language, Specify Groovy
Create a parameter : param_ip,  of the type Generic
View the code section below and copy/paste that into your Script section.


Groovy code

def param_ip = parameters['param_ip'] ?: ''
def client = new RESTClient("${param_ip.toString()}")
def response = client.get()
assert response.statusCode == 200
def str = response.json

Press the Save Button


Now,  Switch to the Preview tab
Enter a Domain or IP address and press the Submit/OK button

ds-tab5a ds-tab5b

SpagoBI DataSet Webservice via Groovy

SpagoBI DataSet Webservice via Groovy

Per SpagoBI Support:

  • Groovy cannot be used in a script-based Dataset to provide rows of data. According to the last support ticket, there is no intent to make that work.
  • SpagoBI Support also states that the Web-Service Dataset is deprecated and so far refuses to document how to use it.

Note: I have not yet figured out how to get a SpagoBI Data Set (of the type Web Service) to work. However… I’ve figured out a way to make it work by creating a SpagoBI Data Set( type Script) and then using Groovy to make a web service call via Groovy WSLite library.

As part of the POC, I used the publicly available Holiday Web Service to look up Mother’s day for any given year. (Groovy WS-Lite uses it as the simple example).

SO… Round-Trip goes something like this

  1. Report is Requested from SpagoBI , given a parameter of “year”.
  2. SpagoBI executes the Document, delegating to the BIRT report engine.
  3. BIRT report engine executes the Report, passing in the parameter of year
  4. The Report has a SpagoBI Data set reference, which passes the year to the SpagoBI Data Set (back in SpagoBI Core)
  5. SpagoBI Data Set
    • Makes a SOAP call via Groovy and Groovy WS Lite library
    • Parses the response
    • Rewrites the response in the XML format standard for SpagoBI Data Sets, and includes the “requested year” and the response (date for Mother’s day)
    • The Report retrieves the data from the SpagoBI Data Set
    • Report renders showing the requested year and the date on which Mother’s Day occurs for that year


Groovy WSLite 2.0
Groovy-based Web-Service library which supports SOAP and RESTful calls

  • 2.0 Beta . Requires Groovy 2.3 or later. Worked fine for SOAP. Failed for RESTful call
  • 1.0 / 0.7.1 : Requires Groovy 1.7.6 or later.  Worked fine for SOAP and REST

Groovy Language
We’re using Groovy WS Lite, required a newer version of Groovy than that which shipped with SpagoBI 5.0 (Groovy 1.5.6)
So, it was necessary to replace the Groovy-all library jar with a later version and add the Groovy WS Lite Jar
Download : groovy-all-2.4.3.jar


  • See instructions for Upgrading Groovy and Installing Groovy WS Lite
  • Log into Spagobi
  • Create a new data set
  • Create a new data set
  • Set the Data Set label
  • Set the Data Set Type (on the Type tab) to Script
  • Set the Language for the Script to Groovy
  • Setup a parameter named “param_year”, with the type of “Generic”
  • Add the script code (below)
import wslite.soap.*
def param_year = parameters['param_year']
// When SpagoBI Studio inquires with SpagoBI Server for the definition of the data set, 
// it will not work because it doesn't pass a default parameter
// Get around this by specifying a parameter value to use when none is provided.
if (param_year ==null) {
   param_year  = "2015"
def client = new wslite.soap.SOAPClient('')
def response = client.send(SOAPAction:'') {
    body {
        GetMothersDay('xmlns':'') {
//assert "2011-05-08T00:00:00" == response.GetMothersDayResponse.GetMothersDayResult.text()
assert 200 == response.httpResponse.statusCode
assert "ASP.NET" == response.httpResponse.headers['X-Powered-By']
// Remember Java doesn't know how to interpret a Groovy GString. The resulting output must be cast to a Java String
// If you leave it as a GString preview in SpagoBI Server will work  but Studio will be unable to attach to the data set.
  • Preview in SpagoBI (Server) providing a year. Press the preview button and you should get the response back from the Holiday Web Service
    Preview Groovy-WS Data Set Prompt

    Preview Groovy-WS Data Set Prompt

    SpagoBI Groovy-WS Preview Result

    SpagoBI Groovy-WS Preview Result

  • The next post will cover consuming that SpagoBI Data Set in a BIRT report

Upgrading Groovy in SpagoBI

Groovy Language

It is possible to create a SpagoBI Script (Groovy-based) Data Set which calls a web service and returns data in the standard XML format needed by consumers of SpagoBI Data Sets. As a proof of concept, I used Groovy-WS Lite (a Groovy SOAP/RESTful client library, which required a newer version of Groovy than that which shipped with SpagoBI 5.0 (Groovy 1.5.x).

So, it was necessary to replace the Groovy-all library jar with a later version and add the Groovy WS Lite Jar (version 2.0 beta was chosen)
Here is how I updated Groovy in SpagoBI core.

Download : and extract the contents to get the file groovy-all-2.4.3.jar

Steps for updating Groovy version in SpagoBI

  1. In SpagoBI/WEB-INF\lib, replace the groovy-all-1.5.x.jar with groovy-all-2.4.3.jar
  2. Add the jar for Groovy-wslite, by dropping in a groovy-wslite jar ( groovy-wslite-2.0.0-20150603.161122-8.jar )
  3. Restart SpagoBI (ex: service tomcat7 restart)

So far, all normal SpagoBI functionality seems to work with the newer version of Groovy