Jump to content

TomW

Hornbill Users
  • Posts

    54
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by TomW

  1. I tried calling a similar API request but this time calling the "read" API method within the "SearchHistory" web service as follows:

    function Get_SearchHistory {
       <#
        .SYNOPSIS
        Attempt to get a list of scheduled requests
       #>
    
       #region : VARIABLES
       [String]$Method = "read"
       [String]$Parameter = @()
       [String]$RestMethod = "post"
       [String]$Service = "apps/com.hornbill.servicemanager/SearchHistory"
       [Int]$deskID = 5 #this field is int32 where the maximum value is 2147483647
       [Int]$RowStart = 1
       [Int]$RowCount = 20 #this field is int32 where the maximum value is 2147483647
       #endregion @ VARIABLES
    
       #region : Assign API parameters
        $Parameter = @(
            "<searchTerm></searchTerm>"
        )
        Write-Host($RowStart)
        #endregion : Assign API parameters
    
       [String]$ParameterIsCMInstalled = "true"
       [String]$ParameterLanguage = "en-GB"
    
       Try {
            $InvokeSmXmlMcParam = @{
                Method = $Method
                Parameter = $Parameter
                RestMethod = $RestMethod
                Service = $Service
                ErrorAction = 'Stop'
           }
           #Write-Host($InvokeSmXmlMcParam)
            $ApiResponse = Invoke-HbRestMethod @InvokeSmXmlMcParam
            
            $retVal = $ApiResponse
    
        } #Try
        Catch {
            $retVal = -1
            Write-Error $_.Exception.Message 
        } #catch
    
        return $retVal
    }

    The output, particularly the JSON, was as follows:

    queryExecJSON                                
    -------------                                
    ["finance","mam","morning","etarmis"]

    Unlike the "getScheduledRequests" API method this one seems to work. I suspect the the "getScheduledRequests" API method is broken. It shows as successful but returns no data even though we have numerous scheduled requests.

  2. I am trying to retrieve a list of requests that have been scheduled using the Hornbill API. The API that I am calling is the getScheduledRequests API and I am using the following PowerShell script:
     

    function Get_ScheduledRequests {
       <#
        .SYNOPSIS
        Attempt to get a list of scheduled requests
       #>
    
       #region : VARIABLES
       [String]$Method = 'getScheduledRequests'
       [String]$Parameter = @()
       [String]$RestMethod = 'post'
       [String]$Service = 'apps/com.hornbill.servicemanager/ScheduledRequests'
       [Int]$RowStart = 1
       [Int]$RowCount = 2147483647 #this field is int32 where the maximum value is 2147483647
       #endregion @ VARIABLES
    
       #region : Assign API parameters
        $Parameter = @(
            #"<searchFilter>h_status=status.open</searchFilter>"
            #"<deskId></deskId>"
            "<rowStart>$RowStart</rowStart>"
            "<rowLimit>$RowCount</rowLimit>"
        )
        #endregion : Assign API parameters
    
       [String]$ParameterIsCMInstalled = 'true'
       [String]$ParameterLanguage = "en-GB"
    
       Try {
            $InvokeSmXmlMcParam = @{
                Method = $Method
                Parameter = $Parameter
                RestMethod = $RestMethod
                Service = $Service
                ErrorAction = 'Stop'
           }
           echo($InvokeSmXmlMcParam)
            $ApiResponse = Invoke-HbRestMethod @InvokeSmXmlMcParam
    
            $retVal = $ApiResponse
    
        } #Try
        Catch {
            $retVal = -1
            Write-Error $_.Exception.Message 
        } #catch
    
        return $retVal
    }

    The value returned is as follows:

    outcome totalRecordCount scheduledRequests
    ------- ---------------- -----------------
    success 0                []               

    We have a lot of requests which have been scheduled so I am wondering if I am passing the wrong information to the API method. I know the rest of the code (not shown above) works fine as I use other Hornbill APIs to run and retrieve reports.

    If you could highlight any obvious mistakes I've made or point me in the right direction that would be a great help!

     

  3. Hello

    I was wondering if it is possible to automatically close a call if it has been active for certain period of time?

    For example if an incident was raised 2 weeks ago and the company has a policy to close all active (open, new, on hold etc.) incidents that are over 2 weeks old.

    Would this have to be done in a workflow or is there a setting in Hornbill that does this?

  4. 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

  5. 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

  6. I have finally got this working after spending too much time barking up the wrong tree. The code to do this in PowerShell is fairly simple:

        [string]$url = $davendpoint + "reports/" + $reportID + "/" + $reportFileLink
        echo("URI: " + $url)
        Try {
            $wc = New-Object System.Net.WebClient
            $wc.Headers.Add("Authorization","ESP-APIKEY " + $apiKey)
            
            $wc.DownloadFile($url,$outputLocation)
            return -1
        }
        Catch {
            Write-Error $_.Exception.Message
            #echo("hey ho pip and dandy")
            return $apiResponse
        }

    The $davendpoint variable is just the combination the values that you advised above.

    thanks for your help.

    Cheers,

    Tom

    • Like 2
  7. Thanks for your advice. The log file shows the following information:

    "2020/01/20 09:36:01 ---- Hornbill Report Runner V1.0.0 ----
    2020/01/20 09:36:01 Flag - Configuration File: conf.json
    2020/01/20 09:36:01 [DEBUG] Loading Config File: C:\Temp/conf.json
    2020/01/20 09:36:43 Running report RCV - Check for Re-Openned Calls [417].
    2020/01/20 09:37:04 [ERROR] Post https://eurapi.hornbill.com/*removed*/reporting/?method=reportRun: dial tcp *removed*:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

    When I use nslookup I get the following information:

    "C:\Temp>nslookup eurapi.hornbill.com
    Server:  *removed*
    Address:  *removed*

    Non-authoritative answer:
    Name:    eurapi.hornbill.com
    Address:  *removed*"

    I am not a network savvy person so I don't understand the response.

  8. I am trying to run and retrieve reports using the Hornbill Report Runner and have entered the relevant information in the conf.json file.

    When I run the command "goHornbillReportRunner_x86.exe -file=conf.json" I get the following response in the command prompt:

    "---- Hornbill Report Runner V1.0.0 ----
    Flag - Configuration File: conf.json
    Running report RCV - Check for Re-Openned Calls [417].
    [ERROR] Post https://eurapi.hornbill.com/'removed'/reporting/?method=reportRun: dial tcp 'removed': connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond."

    Could you offer any advice?

  9. Is there a way to find how much time has been spent working on a call? I know that you can find out how much time a call has been open for "current date - date raised" or "date resolved - date raised", but I am looking for the time the call has been worked on e.g. when someone adds the time that they have spent working on the call when making an update or resolving it.

    Please could you point me in the write direction i.e. what tables and fields that I should be look at?

    Thanks

    Tom

  10. 51 minutes ago, Will J Douglas said:

    @TomW  Are you pulling the information from the Report Data Collection Preview? 

    I found that the the report data collection preview was showing the raw data (in GMT) and the UI and reports were correctly adjusted to my timezone (GMT+4)

    I just had a look and yes this does only appear in the preview window. If you run the report the dates are the normal. It looks like the preview window fix was missed in the last batch of updates.

  11. When looking for re-scheduled change requests I noticed a discrepancy in the time zone types. The dates stored in the 'Start Time' and 'End Time' fields are in GMT (Greenwich Mean Time), but in the  scheduled date shown in the Timeline of the call it appears in BST (British Summer Time) which is one hour ahead!

    1401451116_DateinGMT.thumb.png.1cc6f86306143aad1ec0d9e043a70d64.png

    1138794770_DateinBST.thumb.png.4669cf3c0415734df2ab398f35ee19df.png

    Is this a system setup issue, a minor issue with Hornbill, or something else altogether?

×
×
  • Create New...