PDA

View Full Version : Uploading a Mondrian file to the BA Server using REST API



and.decarlo
01-29-2014, 06:13 PM
Hey Everyone,

I have never used any sort of REST API before, but would like to use the Pentaho Rest API to upload Mondrian xml files to the server. According to http://anonymousbi.wordpress.com/2013/11/28/pentaho-5-restful-web-services/ and several other sites I can accomplish this by using the following request.

http://localhost:8080/pentaho/plugin/data-access/api/mondrian/postAnalysis
Multipart POST request with post params:
uploadAnalysis – Mondrian schema
catalogName – name of the catalog (optional?)
parameters – parameter list

However, for someone like me who is new to this, this is not quite enough for me to start using this. How exactly would I go about running this, what would the url be to put a local file up onto the server? Any help would be appreciated

lucassig
01-30-2014, 03:35 PM
Do you need this automatic?

Why you dont just add a new Datasource?

Asnicar
01-31-2014, 10:00 AM
Hi all,
I'm the same situation as and.decarlo (http://forums.pentaho.com/member.php?88429-and-decarlo). (I would like to create and publish an OLAP cube by an automated process with a Spoon workflow)
I did everything, just missing the schema publication (to be done by hand using a "Schema Workbench").
I'm sure it can be done in an automatic way, maybe there is already a Spoon node made ​​for this ... but I do not know how. :-(
Any help is appreciated

Regards.

and.decarlo
02-03-2014, 11:24 AM
I would like this to be automatic, besides the fact that if there is a REST API to do this than I would like to learn it.

Asnicar
02-04-2014, 07:33 AM
I have found all the answers in the pentaho-mondrianschemaworkbench-plugins (https://github.com/pentaho/pentaho-mondrianschemaworkbench-plugins).
It contains the java code to make the call.

and.decarlo
02-04-2014, 05:02 PM
Thanks, the PublishToServerCommand.java in particular was helpful.

johla
08-08-2014, 06:45 AM
Hi, I'm struggling getting this to work. Working example anyone?

Attached is an example transformation that download a schema from the REST endpoint, thereafter uploading the same under a new catalog.

best,
Lars

caralomi
08-11-2014, 08:54 AM
Perhaps you can use the following utility found here: /server/biserver-ee/import-export.sh (bat)

An example command is shown here:
./import-export.sh

--import

--url=http://localhost:8080/pentaho

--username=admin

--password=password

--file-path=/home/pentaho/SteelWheels.xml

--resource-type=datasource

--datasource-type=analysis

--analysis-datasource=sampledata

--catalog=SteelWheels

--overwrite=true

--xmla-enabled=false

--logfile=/home/pentaho/importlogfile.logfile

mst
09-03-2014, 12:06 PM
Perhaps you can use the following utility found here: /server/biserver-ee/import-export.sh (bat)

An example command is shown here:
./import-export.sh

--import

--url=http://localhost:8080/pentaho

--username=admin

--password=password

--file-path=/home/pentaho/SteelWheels.xml

--resource-type=datasource

--datasource-type=analysis

--analysis-datasource=sampledata

--catalog=SteelWheels

--overwrite=true

--xmla-enabled=false

--logfile=/home/pentaho/importlogfile.logfile

Hi!

I'm experiencing the same problems.

I tried this:

import-export.bat --import --url=http://localhost:8081/pentaho --username=xxxx --password=yyyy --file-path=C:/my/file/Mondrian.xml --resource-type=datasource --datasource-type=analysis --analysis-datasource=MYDATASOUCE --catalog=myCatalog --overwrite=true --xmla-enabled=false --path=/public --retainOwnership=true --permission=true

DEBUG: Using JAVA_HOME
DEBUG: _PENTAHO_JAVA_HOME=c:\Program Files\Java\jdk1.7.0_67
DEBUG: _PENTAHO_JAVA=c:\Program Files\Java\jdk1.7.0_67\bin\java.exe
log4j:WARN Continuable parsing error 3 and column 57
log4j:WARN Document root element "configuration", must match DOCTYPE root "null".
log4j:WARN Continuable parsing error 3 and column 57
log4j:WARN Document is invalid: no grammar found.
log4j:WARN The <configuration> element has been deprecated.
log4j:WARN Use the <log4j:configuration> element instead.
done response = INVALID_MIME_TYPE

What's wrong?
I also tried with --path=/

Using Pentaho 7.1.0.0-752

Any Ideas?

Best regards

yanki69
11-06-2014, 01:57 PM
Hi and.decarlo,
do you know how to do this? I have the same problem and not know how to resolve it. Any help would be appreciated.


Regards.

yanki69
11-06-2014, 02:02 PM
Hi Johla,

i'm very interested for your transformation but can not upload the mondrian schema. (Pentaho 5.2). Do you know why?
Any help would be appreciated.


Regards.

fcorti
12-11-2014, 04:10 AM
Hi all,

Probably it's quite late but I have had a similar problem and I shared a working solution in this post.
http://fcorti.com/2014/12/11/uploading-mondrian-to-pentaho-using-pdi/

I hope this will help someone else... looking around in the web, many people. ;-)

Cheers.

teruok78
03-21-2015, 11:40 PM
Hi Francesco,

Thank you for your good blog article!
http://fcorti.com/2014/12/11/uploading-mondrian-to-pentaho-using-pdi/

I tried to change your code for repository API "/pentaho/api/repo/files/import".
I could send a text file, but I could not send a binary file.

steelwheels.xanalyzer (text file)
-> success (200 OK)

sample_report.prpt (binary file)
-> fail (400 Bad Request)
error message: The request sent by the client was syntactically incorrect.

Do you know how to send binary files?

Best,
Teruo Kawasaki

14660

fcorti
03-22-2015, 03:01 AM
Hi Teruo,

Your goal is quite different from the purpose of this post but I should have the solution because I needed to upload a generic file into the repository.

If you want to see a working transformation you can take a look at "Create target folder and upload file" in the AAAR_Kettle repository of the AAAR project you can see and install here:
http://fcorti.com/alfresco-audit-analysis-reporting/aaar-how-to-install/aaar-get/

I hope this helps you.

teruok78
03-22-2015, 09:41 AM
Hi Francesco,

Thank you for your reply!
I'll try.

Teruo

kwb
05-31-2015, 07:57 PM
Re-bumping the above thread to add a bit...

For those who want to simply upload a mondrian xml schema file to Pentaho BI instance from the command line, there is a simple solution I found using curl to call the rest api.

This was stolen from Fernando, who posted the solution here: https://groups.google.com/forum/#!topic/pentaho-community/BldT9-z7bHA



#!/bin/bash
#Uploads a schema file to the local instance of Pentaho
echo "Uploading schema file to Mondrian/Pentaho"
curl -f -include --user admin:password -F "uploadAnalysis=@Schema.xml" -F "catalogName=Schema" \
-F "overwrite=true" -F "xmlaEnabledFlag=false" \
-F "parameters=DataSource=datasourcename" http://localhost:8080/pentaho/plugin/data-access/api/mondrian/postAnalysis


if [ $? -eq 0 ]; then
echo "***"
echo "Success uploading schema"
exit 0
else
echo "!!!"
echo "Failure uploading mondrian schema"
exit 1
fi

dansari
10-13-2016, 04:02 PM
Perhaps you can use the following utility found here: /server/biserver-ee/import-export.sh (bat)

An example command is shown here:
./import-export.sh

--import

--url=http://localhost:8080/pentaho

--username=admin

--password=password

--file-path=/home/pentaho/SteelWheels.xml

--resource-type=datasource

--datasource-type=analysis

--analysis-datasource=sampledata

--catalog=SteelWheels

--overwrite=true

--xmla-enabled=false

--logfile=/home/pentaho/importlogfile.logfile

This didn't work for me. I spent a while getting it to work from PowerShell, then reverted back to import-export.bat (on Windows Server) and managed to make it work after studying the Java source:

.\import-export.bat --import --url=http://localhost:8080/pentaho --username=admin --password=password --file-path=C:\Installers\Schema\whatever.xml --resource-type=DATASOURCE --datasource-type=ANALYSIS --analysis-datasource=sampledata --overwrite=false

Note the capitalization.