Forum Discussion

Gautier's avatar
Gautier
Frequent Visitor
9 years ago
Solved

Connect to Business Object Webi report through RESTful request

Hi,

 

I have found a workaround to get access to my Webi reports using the SAP Restful API.

It works very well with Power BI. Basically the GET request I am sending looks like this:

 

http://<base url>:6405/biprws/raylight/v1/documents/<doc id>/reports/<report id>
with the following headers:
X-SAP-LogonToken=<logontoken>
Accept="text/csv"

 

In Power query the source line looks like this:
Source=Csv.Document(Web.Contents("<base url>:6405/biprws/raylight/v1/documents/<doc id>/reports/<report id>",[Headers=[#"X-SAP-LogonToken"="""<logontoken>""",Accept="text/csv"]]))

 

My only problem is how to get the logontoken from the post request with powerquery. My knowledge of powerquery is limited so maybe someone can help me to send the required POST call to SAP from Powerquery and then store the logontoken in a variable that will be used in the GET report call.

  • Continuing my previous post:

     

    2 issues arise when I upload to Power BI service and try to refresh through the data gateway:

     

    1) functions are not accepted - fixed easily by adding the logon function within the main query as a subquery

     

    2) the main query credential (anonymous) isn't accepted by Power BI services  - fixed by using relativepath in my webcontent()

     

    Also I have added to my query a first subquery to retrieve the report ID of the latest instance of the report stored in Business Object.

     

    If anyone is interested to see the details I am happy to share my query.

     

     

     

11 Replies

  • Gautier's avatar
    Gautier
    Frequent Visitor

    Replying to myself:

     

    I used this thread to send a POST call to SAP BO.

     

    My GetToken() function in powerquery looks like this:

     

    let
    Source = () => let
    body = Text.ToBinary("<attrs>
    <attr name=""userName"" type=""string""><username></attr>
    <attr name=""password"" type=""string""><password></attr>
    <attr name=""auth"" type=""string"" possibilities=""secEnterprise,secLDAP,secWinAD,secSAPR3"">secWinAD</attr>
    </attrs>"),
    actualUrl = "baseurl",
    options = [
    Headers =[#"Content-type"="application/xml",#"Accept"="application/json"],
    Content=body
    ],
    result = Web.Contents(actualUrl, options),
    #"Imported JSON" = Json.Document(result,1252),
    logonToken = #"Imported JSON"[logonToken]
    in
    logonToken
    in
    Source

     

     

    • Gautier's avatar
      Gautier
      Frequent Visitor

      Continuing my previous post:

       

      2 issues arise when I upload to Power BI service and try to refresh through the data gateway:

       

      1) functions are not accepted - fixed easily by adding the logon function within the main query as a subquery

       

      2) the main query credential (anonymous) isn't accepted by Power BI services  - fixed by using relativepath in my webcontent()

       

      Also I have added to my query a first subquery to retrieve the report ID of the latest instance of the report stored in Business Object.

       

      If anyone is interested to see the details I am happy to share my query.