Use REST API to upload Mondrian Schema to BI Server

Problem

You would like to use REST API to upload a Mondrian Schema to the BI Server.

(The bellow solution was tested with Pentaho 6.0.1.0 Version)

Dependencies

For the below code you will need two external dependencies: one for sending HTTP requests and the other one for encrypting your credentials for Basic Authentication.

Code

The code is pretty much self-explanatory, but here are some highlights:

  • We encode our credentials to the server with Base64 for the Basic Authentication.
  • Create a request against BI Server’s endpoint for uploading Mondrian Schemas.
  • We add the basic authentication header to the request.
  • In the request we send a multipart value with our Mondrian Schema alongside few addtional parameters (explained in the official documentation).
  • Send the request and receive a response.

Multipart-data.xml

Last but not least the file with multi-part data that among others contains a Mondrian Schema that we wish to upload to the server.

Please join discussion