Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Expand
titleSetting up the ImportContent object

Setting up the ImportContent object to specify the content that needs to be imported, requires you need to define the optionKey parameter by providing its optionValue. Here are some combinations that you can use:

 

optionKeyoptionValue
SKIP"true" or "false".
OPTION"REPLACE" or "ADD".
EXISTING

UUID of the existing item in the target Yellowfin instance.

This workds with optionKey=OPTION and optionValue=REPLACE.

PASSWORD1Data source password if you want the content to be encrypted during import.

 

For instance, if you exported one Yellowfin report with its dependencies (data source, view, category, sub category), your ContentResource object (which you get with GETIMPORTCONTENT call) will display the following:

ResourceIdResourceTypeResourceNameResourceUUID

70031

DATASOURCE

CSV

null

70209

VIEW

months

b974f55a-269b-4a4b-b1c6-bf9b968be723

null

RPTCATEGORY

Tutorial

a23c2ec6-a2fa-45c7-b5da-dcf3f02e6633

null

RPTSUBCATEGORY

Reports

58834ae1-2f65-44c0-b6c3-7c9cd2f91bd5

70279

REPORT

My Report

fd3794b3-62c0-4cf8-bac0-755e68d9c41e

 

Now you need to define import options for all 5 items. ImportOption's itemIndex parameter will correspond to the index number of each of the ContentResource items so that for the ContentResource array example above, the following will be displayed:

ResourceId

ResourceType

importOption itemIndex

70031

DATASOURCE

0

70209

VIEW

1

null

RPTCATEGORY

2

null

RPTSUBCATEGORY

3

70279

REPORT

4

 

But if you want to replace the report with another existing report in our example, and skip the rest of the content from being imported, here is how you wll will configure the ImportOption object:

itemIndex

optionKey

optionValue

Note

0

SKIP

true

The data source will be skipped.

1

SKIP

true

The view will be skipped.

2

SKIP

true

The category will be skipped.

3

SKIP

true

The subcategory will be skipped.

4

SKIP

false

The report will be imported.

4

OPTION

REPLACE

The existing report will be replaced with the imported one.

4

EXISTING

70287

This is the report ID of the report existing in the target Yellowfin that will be replaced with the imported report.

 

Note, however, that if trying to import content as 'new', you must specify its dependencies in the ImportOption object. Therefore, a new report cannot be imported without importing its required dependencies (that is, view, category, and sub category). (Note: You can choose to REPLACE the dependencies of a report with those existing in the target environment, instead of using the ones retrieved from the export file.) See below for the required dependencies of the main content types:

ContentRequired Dependencies

Report

View, category, subcategory

View

Data source

Dashboard

Category, subcategory

...

Expand
titleGETIMPORTCONTENT

This function reads a provided YFX or XML file and places specific content from it into the ContentResource object that can be imported.

 

Request Parameters

The following parameters should be passed with this request:

Request Element

Data Type

Description

LoginId

String

An admin account to connect to Yellowfin web services. This can be the user ID or the email address, depending on the Logon ID method.

This account must have the “web services” role enabled, and must belong to the default (i.e. primary) org.

Password

String

Password of the above account.

OrgId

Integer

Default (i.e. primary) organization ID within Yellowfin. Always set this to 1.

Function

String

Web service function. Set this to "GETIMPORTCONTENT".

OrgRefStringThis optional parameter can be used to specify a client org. ID.
ParameterString[]

This array contains strings with details of content that is to be imported from a file. The first string is a byte array of UTF-8 string. The second is the file type, that is "YFX" or "XML".

 

Response Parameters

The returned response will contain these parameters:

Response Element

Data Type

Description

StatusCode

String

Status of the web service call. Possible values include:

  • SUCCESS
  • FAILURE
ContentResourcesContentResource[]Object array containing details of Yellowfin's content to be imported.

 

Instructions

See below for step-by-step instructions on how to perform this call, using a Java example:

Expand
titleStep-by-step instructions
  • Define the request for this function, which includes logging in as the admin user and specifying the web service call to perform:

    Code Block
    languagejava
    themeConfluence
    rsr.setLoginId("admin@yellowfin.com.au"); 
    rsr.setPassword("test"); 
    rsr.setOrgId(1);
    rsr.setFunction("GETIMPORTCONTENT");
  • Specify the file containing data that is to be imported:

    Code Block
    languagejava
    Path path = Paths.get("/Applications/Yellowfin 7.4/qwerty.yfx"); 
    
    byte[] data = Files.readAllBytes(path);
    byte[] encodeBase64 = java.util.Base64.getEncoder().encode(data);
    String f = new String(encodeBase64, "UTF-8");
  • Provide the extension of this file, i.e. either YFX or XML:

    Code Block
    languagejava
    rsr.setParameters(new String[]{f,"YFX"});
  • Once the request is configured, perform the call:

    Code Block
    languagejava
    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

    Initialize the Administration web service. Click here to learn how to do this. 

 

  • The response will contain the following elements: StatusCode and ContentResource. (See details in the Response Parameters table above.)

     

 

 

Complete Example

Below is a full example of this web service call. To use it for yourself, carry out the following the steps:

  1. Copy the code and save it as ws_ getimportcontent.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, and admin user details according to your environment.
  4. Run http://<host>:<port>/ws_ getimportcontent.jsp from your Internet browser.

 

Code Block
languagejava
themeEclipse
<%   	
/*    	ws_getimportcontent.jsp                    	*/
%>
<%@ page language="java" contentType="text/html; charset=UTF-8" %>
<%@ page import="com.hof.util.*, java.util.*, java.text.*" %>
<%@ page import="com.hof.web.form.*" %>
<%@ page import="com.hof.mi.web.service.*" %>
<%@ page import="java.nio.file.Files" %>
<%@ page import="java.nio.file.Paths" %>
<%@ page import="java.nio.file.Path" %>
 
<%
AdministrationServiceService s_adm = new AdministrationServiceServiceLocator("localhost",8080, "/services/AdministrationService", false);    	// adjust host and port number
AdministrationServiceSoapBindingStub adminService = (AdministrationServiceSoapBindingStub) s_adm.getAdministrationService();
AdministrationServiceRequest rsr = new AdministrationServiceRequest();
 
rsr.setLoginId("admin@yellowfin.com.au"); 				// provide your Yellowfin web services admin account
rsr.setPassword("test");                                // set to the password of the above account
rsr.setOrgId(1);
rsr.setFunction("GETIMPORTCONTENT");
 
Path path = Paths.get("/Applications/Yellowfin 7.4/qwerty.yfx"); 		// existing file
 
byte[] data = Files.readAllBytes(path);
byte[] encodeBase64 = java.util.Base64.getEncoder().encode(data);
String f = new String(encodeBase64, "UTF-8");
 
rsr.setParameters(new String[]{f,"YFX"});
 
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
 
if ("SUCCESS".equals(rs.getStatusCode()) ) {
        	ContentResource[] cr = rs.getContentResources();
        	out.write("<br>Success");
        	for (ContentResource o : cr){
                    	out.write("<br><br>resourceType: " + o.getResourceType());
                    	out.write("<br>resourceCode: " + o.getResourceCode());
                    	out.write("<br>resourceName: " + o.getResourceName());
                    	out.write("<br>resourceDescription: " + o.getResourceDescription());
                    	out.write("<br>resourceOrgId: " + o.getResourceOrgId());
                    	out.write("<br>resourceId: " + o.getResourceId());
                    	out.write("<br>resourceUUID: " + o.getResourceUUID());
        	}
} else {
        	out.write("Failure");
        	out.write(" Code: " + rs.getErrorCode());
}
%>


 


 

...