Automated receipt of OBIEE reports by the client

Sometimes the task arises of obtaining a report at the client’s workplace without using an interactive means of interaction in the form of a browser.

In the days of Oracle Reports, a similar problem was solved through the use of the rwclient utility. What can be applied to this in Oracle BIEE? – we use the provided REST API for Oracle BI Publisher:

  1. Let’s create a report, let it be available in the directory: /~scott.tiger/Example;
  2. By request through the utility curl we get the server response, saving it to a file:
    curl -X POST -u login:password  -o report_out.xlsx -H "Content-Type:multipart/form-data" -v -F 'ReportRequest={"attributeFormat":"xlsx","attributeTemplate":"Publisher Template"};type=application/json' http://hostname:port/xmlpserver/services/rest/v1/reports/~scott.tiger%2FExample/run
  3. Since the content of the response in the report_out.xlsx document is not yet Excel, but a multipart document (see. RFC 7578), then we process the document, biting off unnecessary details:
    perl -i -pe 'BEGIN{undef $/;} s/.*rnrn(.*?)rn--Boundary[^n]*?--rn/$1/sm' report_out.xlsx
  4. We make sure that the report works by opening it through Excel on the client machine.
  5. We glue the developments together through the pipe and get a ready-made solution:
    curl -X POST -u login:password  -H "Content-Type:multipart/form-data" -v -F 'ReportRequest={"attributeFormat":"xlsx","attributeTemplate":"Publisher Template"};type=application/json' http://nameserv:port/xmlpserver/services/rest/v1/reports/~scott.tiger%2FExample/run |  perl -pe 'BEGIN{undef $/;} s/.*rnrn(.*?)rn--Boundary[^n]*?--rn/$1/sm' > report_output.xlsx

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *