> For the complete documentation index, see [llms.txt](https://docs.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentaho.com/pdia-admin/embed-and-extend-pentaho-functionality-cp/embed-pentaho-server-functionality-into-web-applications.md).

# Embed Pentaho Server functionality into web applications

The following samples use various development techniques to demonstrate how to embed Pentaho Server functionality and content into another web application.

These samples are for developers with HTML and JavaScript experience. We assume also you have a correctly installed and configured the Pentaho Server running locally on your machine along with knowing how to start and stop the server if necessary. See the **Install Pentaho Data Integration and Analytics** document for instructions on installing and configuring the Pentaho Server.

## Get started with the embedded samples

To download and deploy the samples to your Pentaho Server, perform the following steps:

1. On the [Support Portal](https://support.pentaho.com/home), sign in using the Pentaho support user name and password provided in your Pentaho Welcome Packet.
2. Click **Downloads**, then navigate to the Pentaho GA Release page, which matches your version of the software.
3. On the bottom of the Pentaho GA Release page, in the file component section, click the **SDK** folder and download the `pentaho-sdk- 10.3.0.zip` file.

   The readme file contains the information for deployment.
4. Stop the Pentaho Server.
5. Run **SDK** > **Installer.bat** (or the corresponding script for your OS) to uncompress these two folders to your selected location: `integration-examples` and `platform-plugins`.
6. Copy the `integration-examples` directory to your `pentaho-server/tomcat/webapps` directory.
7. Open the `platform-plugins` directory and copy the following two directories: `example-visualization` and `oem-tools`.
8. Paste the `example-visualization` and `oem-tools` directories into the `pentaho-server/pentaho-solutions/system` directory.
9. Restart the Pentaho Server.

The samples are deployed and can be accessed by opening a web browser and navigating to <http://localhost:8080/integration-examples>. If you want to access the OEM tools, browse to [http://localhost:8080/pentaho/conten...web/index.html](http://localhost:8080/pentaho/content/oem-tools/resources/web/index.html). If you want to access the example-visualization, look under the **Charts** menu in Analyzer. It will be listed as **Example KPI**.

To deliver content as well as expose various services, we use a REST web interface. These sections comment on the various samples and how they use the REST URLs. For the full reference of the Pentaho REST API, please refer to [http://javadoc.pentaho.com](http://javadoc.pentaho.com/).

{% hint style="info" %}
**Note:** The REST APIs often allow interaction with repository files. The REST API expects references to repository files to be specified using the `:` character as file separator.
{% endhint %}

## Report Designer samples

The following samples show how to render Report Designer reports in various web applications.

### Execute a report from a HTML form (POSTing parameters)

This sample renders a Report Designer (PRPT) report by posting the report parameters to the report REST URL:

`http://localhost:8080/pentaho/api/repos/<path>/generatedContent`

The POST request contains all parameters the report expects, plus the additional rendering parameter **output-target**, which controls the rendering format (HTML, PDF, XLS, etc.)

The following output formats are supported:

| **Option**                                                                         | **Purpose**                                                                       |
| ---------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| `table/html;page-mode=stream`                                                      | HTML as a single page, all report pagebreaks are ignored.                         |
| `table/html;page-mode=page`                                                        | HTML as a sequence of physical pages, manual and automatic pagebreaks are active. |
| `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;page-mode=flow` | Excel 2007 XLSX Workbook                                                          |
| `table/excel;page-mode=flow`                                                       | Excel 97 Workbook                                                                 |
| `table/csv;page-mode=stream`                                                       | CSV output                                                                        |
| `table/rtf;page-mode=flow`                                                         | Rich text format                                                                  |
| `pageable/pdf`                                                                     | PDF output                                                                        |
| `pageable/text`                                                                    | Plain text                                                                        |
| `pageable/xml`                                                                     | Pageable layouted XML                                                             |
| `table/xml`                                                                        | Table-XML output                                                                  |
| `pageable/X-AWT-Graphics;image-type=png`                                           | A single report page as PNG.                                                      |
| `mime-message/text/html`                                                           | MIME email with HTML as body text and all style and images as inline attachments. |

### Render a report in an IFRAME

This sample renders a PRPT report using a regular GET request, by populating an HTML IFRAME with the report REST URL:

`http://localhost:8080/pentaho/api/repos/<path>/generatedContent?<parameters>`

The request contains all parameters as part of the URL.

### Render report viewer with available parameters and executed report

The sample renders the **Pentaho Report Viewer IU** by populating an HTML IFRAME with the report REST URL:

`http://localhost:8080/pentaho/api/repos/<path>/viewer?<parameters>`

The request contains the initial report parameters as part of the URL.

## Publish a file to the Pentaho Server

Follow this process if you want to publish a file to the Pentaho Server:

Click the link that publishes a file to the Pentaho Server: `http://localhost:8080/api/repo/publish/publishfile`. This publishes the file to the provided path in the repository. Note that the file will be overwritten if the overwrite flag is set to `true`.

| Name              | Description                                                                         | Type     | Default |
| ----------------- | ----------------------------------------------------------------------------------- | -------- | ------- |
| **pathId**        | (colon separated path for the repository file)                                      | formdata | false   |
| **fileContents**  | (input stream containing the data)                                                  | formdata | false   |
| **overwriteFile** | (flag to determine whether to overwrite the existing file in the repository or not) | formdata | false   |
| **fileInfo**      | (information about the file being imported)                                         | formdata | false   |

Sample code for reference purposes can be found at [Github for Pentaho](https://github.com/pentaho). Look for the file called `PublishRestUtil.java` under the **pentaho-reporting** repostitory.

The file is now published to the Pentaho Server and is available to users.

## Analyzer samples

The following samples show how to embed Analyzer reports into other web applications.

### Display a report in viewer mode

This sample renders a display using a regular `GET` request, by populating an HTML IFRAME with the report REST URL:

```
http://localhost:8080/pentaho/api/repos/<path>/viewer
```

The viewer has limited possibilities for interaction and does not allow changing the report.

### Display a report in editor mode

The sample renders a full **Analyzer IU** by populating an HTML IFRAME with the report REST URL:

```
http://localhost:8080/pentaho/api/repos/<path>/editor
```

The IFRAME now renders the full Analyzer user interface, allowing users to interact with the data.

### Create a new Analyzer report

The sample prepares a new Analyzer report by populating an HTML IFRAME with the report REST URL:

{% code overflow="wrap" %}

```
http://localhost:8080/pentaho/api/repos/xanalyzer/editor?
catalog=<Schema>&cube=<CubeName>
```

{% endcode %}

The mandatory **catalog** and **cube** parameters specify the analysis schema and cube to use for the new report.

### Integrate into a custom web application via an IFRAME

The sample opens a new page that mimics a parent application that integrates Analyzer using an IFrame. The parent application has a set of buttons interacting with the **Analyzer UI** in the embedded IFRAME. Studying this page is a good starting point, if you are trying to deeply integrate analyzer into your own web application.

### Specify the select schema service

The sample is opened with a specified data service.

```
http://localhost:8080/pentaho/api/repos/xanalyzer/service/selectSchema
```

After a data service is selected, the sample opens and shows an unsaved Analyzer report using that data service.

## Interactive Reports samples

The following samples show how to embed Interactive Reports into other web applications.

### Display Interactive Reports

This sample renders a PRPTI report using a regular `GET` request, by populating an HTML IFRAME with the report REST URL. The viewer has limited possibilities for interaction and cannot edit the report. The example below shows how to do this by replacing the path within the <> with the URL for the report that you want to view.

{% code overflow="wrap" %}

```
http://localhost:8080/pentaho/api/repos/*&lt;%3Ayour%3Apath%3Agoes%3Ahere.prpti&gt;*/prpti.view
```

{% endcode %}

You can use the `prpti.edit` end-point instead, to allow more user interaction with the report.

{% code overflow="wrap" %}

```
http://localhost:8080/pentaho/api/repos/*&lt;%3Ayour%3Apath%3Agoes%3Ahere.prpti&gt;*/prpti.edit
```

{% endcode %}

### Create new Interactive Reports

The sample prepares a new report by populating an HTML IFRAME with the report REST URL.

{% code overflow="wrap" %}

```
http://localhost:8080/pentaho/api/repos/pentaho-interactive-reporting/prpti.new

```

{% endcode %}

In order to show the toolbar buttons so that users can create, open, or save Interactive reports, add the following to the end of the URL.

{% code overflow="wrap" %}

```
?showRepositoryButtons=true

```

{% endcode %}

Users will be prompted to select the data source they want to work with.

### Integrate into a custom web application via an IFRAME

The sample opens a new page that mimics a parent application that integrates the Interactive Reports editor using an IFrame. The parent application has a set of buttons interacting with the **Interactive Reporting UI** in the embedded IFRAME. Studying this page is a good starting point, if you are trying to deeply integrate Interactive Reports into your own web application.

## Action sequence samples

The following samples show how to embed an action sequence into other web applications.

### Run an action sequence to generate a report

This sample renders an XACTION report using a regular `GET` request, by populating an HTML IFRAME with the report REST URL:

```
http://localhost:8080/pentaho/api/repos/<path>/generatedContent?<parameters>
```

The parameters for the xaction are passed as simple `GET` parameters on the URL.

### Run an action sequence to generate a report with prompts

The sample prepares a form to collect parameters and POSTs them to the xaction REST URL:

```
http://localhost:8080/pentaho/api/repos/<path>/generatedContent
```

The XACTION now retrieves its parameters from the POST request body.

## Configure the proxy trusting filter

If you have set the Pentaho Server to run on a specific IP address or hostname other than the default 127.0.0.1, you must modify the trusted proxy to match that address or hostname for Pentaho plugins to run as expected. Additionally, if you have applications that access Pentaho Server resources, such as REST APIs, you must add that application's IP address so that the Pentaho Server will accept those requests.

1. Stop the Pentaho Server.
2. Open `pentaho-server/tomcat/webapps/pentaho/WEB-INF/web.xml` and search for `TrustedIpAddrs`.

   **Note:** The **param-value** immediately below `TrustedIpAddrs` is a comma-separated list of IP addresses that should be trusted.
3. Add the IP address of the host machine.

   <pre class="language-xml" data-overflow="wrap"><code class="lang-xml">&#x3C;filter>
       &#x3C;filter-name>Proxy Trusting Filter&#x3C;/filter-name>
       &#x3C;filter-class>org.pentaho.platform.web.http.filters.ProxyTrustingFilter&#x3C;/filter-class>
           &#x3C;init-param>
               &#x3C;param-name>TrustedIpAddrs&#x3C;/param-name>
               &#x3C;param-value>127.0.0.1&#x3C;/param-value>
               &#x3C;description>Comma separated list of IP addresses of a trusted hosts.&#x3C;/description>
           &#x3C;/init-param>
   &#x3C;/filter>
   </code></pre>
4. Start the Pentaho Server.

## Developer support

The examples in this section are simple and easy to follow, but with more complex requirements come more advanced programs. While reading the source code comments can help quite a bit, you may still need help to develop an application within a reasonable time-frame. Should you need personal assistance, you can have direct access to the most knowledgeable support resources through a Pentaho Enterprise Edition software vendor annual subscription:

[ISV/OEM support options](http://www.pentaho.com/service/technical-support)

If phone and email support are not enough, Pentaho can also arrange for an on-site consulting engagement:

[Consultative support options](http://www.pentaho.com/services/consulting/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.pentaho.com/pdia-admin/embed-and-extend-pentaho-functionality-cp/embed-pentaho-server-functionality-into-web-applications.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
