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

Error rendering macro 'rw-search'

null

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

 

 

This web service is used to retrieve users' avatar images. If an avatar image is not set up for a user in Yellowfin, then no image will be retrieved for that user. This service requires the users' internal IDs (that is, their IP ID).

 

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 "GETAVATARS".

ParametersString[]An array containing the internal IDs (or IpId) of Yellowfin users’ whose avatars you want to retrieve. Each ID must be passed as a String, even though it's an Integer.

 

 

Request Example

Below is a SOAP XML example for this request:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:remoteAdministrationCall> 
         <arg0>
            <loginId>admin@yellowfin.com.au</loginId>
            <password>test</password>
            <orgId>1</orgId>
            <function>GETAVATARS</function>
            <parameters>
            	<string>13000</string>
            </parameters>
         </arg0>
      </web:remoteAdministrationCall>
   </soapenv:Body>
</soapenv:Envelope>

 

 

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

binaryAttachments

ReportBinaryObject[]

Contains avatar images for the specified users.

 

 

Response Example

The service will return the below response, according to our SOAP example:

 

 

 

Instructions

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

  • Start with a basic request for this function, which includes logging in as the admin user and specifying the web service call to perform:

    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("GETAVATARS");
  • You can specify the users' IP IDs:

    rsr.setParameters(new String[] {"5","13073"});
    



  • Once the request is configured, perform the call:

    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
    

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

 

  • The response will contain a StatusCode element, along with a BinaryAttachment array.

  • To get the first image, use the following:

    byte[] data = response.getBinaryAttachments[0].getData();
    



 

 

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_ getavatars.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, and admin user according to your environment.
  4. Run http://<host>:<port>/ws_ getavatars.jsp from your Internet browser.

 

<%            
/*              ws_getavatars.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.*" %>
<html>
<body>
<%
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("GETAVATARS");
rsr.setParameters(new String[] {"5","13073"});
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

if ("SUCCESS".equals(rs.getStatusCode()) ) {
	ReportBinaryObject[] objects = rs.getBinaryAttachments();
	if (objects != null) {
		byte[] data,encodeBase64;
		String base64Encoded;


		for(ReportBinaryObject o: objects){
			data = o.getData();
			if (data != null){


				encodeBase64 = java.util.Base64.getEncoder().encode(data);
				base64Encoded = new String(encodeBase64, "UTF-8");
				if (base64Encoded != null)  
					out.write("<br>");
				%>
				<img src="data:image/jpg;base64,<%=base64Encoded%>" alt="No image">
				<%
			}
		}
	}
} else {
	out.write("Failure");
	out.write(" Code: " + rs.getErrorCode());
}
%>
</body>
</html>

 


 

This web service is used to upload an avatar image for a specified user. The image should be an array of bytes in UTF-8 which you could convert to a String value.

 

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 "SETAVATARIMAGE".

PersonAdministrationPersonThis object contains details of the user whose avatar is to be changed. See table below.
ParametersString[]An array containing a single element representing the avatar image to be uploaded. The image should be an array of bytes in UTF-8 format, which could be converted to a String.

These are the main parameters that you must set in the AdministrationPerson object for this web service call:

AdministrationPerson Element

Data Type

Description

IpId

Integer

Provide the Yellowfin internal ID of the user. This value is stored in the Person parameter's IpId field,

 

 

Request Example

Below is a SOAP XML example for this request:

 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservices.web.mi.hof.com/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:remoteAdministrationCall> 
         <arg0>
            <loginId>admin@yellowfin.com.au</loginId>
            <password>test</password>
            <orgId>1</orgId>
            <function>GETAVATARS</function>
            <parameters>
            	<string>13000</string>
            </parameters>
         </arg0>
      </web:remoteAdministrationCall>
   </soapenv:Body>
</soapenv:Envelope>

 

 

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

binaryAttachments

ReportBinaryObject[]

Contains avatar images for the specified users.

 

 

Response Example

The service will return the below response, according to our SOAP example:

 

 

 

Instructions

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

  • Start with a basic request for this function, which includes logging in as the admin user and specifying the web service call to perform:

    AdministrationServiceRequest rsr = new AdministrationServiceRequest();
    
    rsr.setLoginId("admin@yellowfin.com.au");
    rsr.setPassword("test");
    rsr.setOrgId(1);
    
    rsr.setFunction("GETAVATARS");
  • You can specify the users' IP IDs:

    rsr.setParameters(new String[] {"5","13073"});
    



  • Once the request is configured, perform the call:

    AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);
    

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

 

  • The response will contain a StatusCode element, along with a BinaryAttachment array.

  • To get the first image, use the following:

    byte[] data = response.getBinaryAttachments[0].getData();
    



 

 

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_ getavatars.jsp.
  2. Put the file in the root folder: Yellowfin/appserver/webapps/ROOT.
  3. Adjust the host, port, and admin user according to your environment.
  4. Run http://<host>:<port>/ws_ getavatars.jsp from your Internet browser.

 

<%            
/*              ws_getavatars.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.*" %>
<html>
<body>
<%
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("GETAVATARS");
rsr.setParameters(new String[] {"5","13073"});
AdministrationServiceResponse rs = adminService.remoteAdministrationCall(rsr);

if ("SUCCESS".equals(rs.getStatusCode()) ) {
	ReportBinaryObject[] objects = rs.getBinaryAttachments();
	if (objects != null) {
		byte[] data,encodeBase64;
		String base64Encoded;


		for(ReportBinaryObject o: objects){
			data = o.getData();
			if (data != null){


				encodeBase64 = java.util.Base64.getEncoder().encode(data);
				base64Encoded = new String(encodeBase64, "UTF-8");
				if (base64Encoded != null)  
					out.write("<br>");
				%>
				<img src="data:image/jpg;base64,<%=base64Encoded%>" alt="No image">
				<%
			}
		}
	}
} else {
	out.write("Failure");
	out.write(" Code: " + rs.getErrorCode());
}
%>
</body>
</html>

 


 

  • No labels