Jump to content

Passing 'User prompted input' values when using the 'reporting' APIs


Recommended Posts

I have been writing code to run, check and retrieve reports using the Hornbill API (via a PowerShell script), and this all works fine.
However a couple reports have filters like "Requests -> Date Logged value is less than <User prompted input>". Is It possible to pass the "<User prompted input>" values when using the API, e.g. using something like the 'runtimeParameter' input parameter? If so how would I go about doing this?

I've had a look at the source code for the 'goHornbillReportRunner-master' but the report runner doesn't include an option for this.

Any advice would be useful, even confirming if this isn't possible would help as it would stop me barking up a none existent tree.

Cheers
Tom

Link to comment
Share on other sites

Hi @TomW,

Sure, check out the API documentation for a detailed description, but basically you need to add the runtimeParameter input parameter to your API call, which in XML would look something like this:

<runtimeParameter>
  <inputParameter>
    <uuid>
      the id of the first input param - match this up to select section in report definition
    </uuid>
    <value>
      the value of the first input param
    </value>
  </inputParameter>
  <inputParameter>
    <uuid>
      the id of the second input param - match this up to select section in report definition
    </uuid>
    <value>
      the value of the second input param
    </value>
  </inputParameter>
</runtimeParameter>

Cheers,
Steve

Link to comment
Share on other sites

Further to the issue above I have been trying to pass the user input variable when calling the "reportRun" API as follows:

    $Parameter = @(
        "<reportid>$reportID</reportid>"
         "<runtimeParameter><inputParameter><uuid>idDateLogged</uuid><value>2019-04-30 00:00:01</value></inputParameter></runtimeParameter>"
    )

 

When the code runs I get the error:

Running report: 516
Run-HbReport : The element <uiid> was expected 1 time(s) at location '/methodCall/params/runtimeParameter/inputParameter/uuid' but encountered <uuid> instead
At G:\Release Team\PowerBI\Incidents Related to Known Errors and Problems - Exp\Experiments\RCV - Known Errors Problems and Associated Calls\PowerShell Script\Run and
Download Report.ps1:369 char:23
+     $runRepResponse = Run-HbReport($reportId)
+                       ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Run-HbReport

 

The value "idDateLogged" in my code is the variable reference name that is stored when the user is asked to input a date when running the report manually. Although I may be using the wrong value for the uuid the error message returned shows that it was expecting the element "<uiid>" which isn't mentioned anywhere in the API documentation for the "reportRun" API method, and is not present in the PowerShell code that I wrote.

Please could you offer some advice?

Cheers

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...