Jump to content

Ben Paddick

Hornbill Users
  • Posts

    26
  • Joined

  • Last visited

Everything posted by Ben Paddick

  1. @Ehsan thanks again for all your help. We are now able to continue developing our solution!
  2. @Ehsan That worked!!! So it seems "customFields" a required field even if just {}?
  3. Hi @Ehsan Thank you for getting back to me. FYI - I am using the Power Shell module to interact with the API. If I test with trying to update "h_external_ref_number" and/or "h_description" I do not get any errors back. These are the values: $xmlmcOutput.status = "ok" $xmlmcOutput.error = NULL $xmlmcOutput.exceptionName = NULL $xmlmcOutput.exceptionDescription = NULL I have cut the script right back to just the following f Add-Param "requestId" "SR00167255" #Add-Param "h_summary" "Summary blah blah again" Add-Param "h_description" "description blah blah again" Add-Param "h_external_ref_number" "1234567" #Add-Param "customFields" "{"h_custom_p": "someValueA"}" # Invoke XMLMC call - Get all Service Request that match search query, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.servicemanager/Requests" "update" # Read output status if($xmlmcOutput.status -eq "ok") { # "No error returned - here are outputs" "API Call Status : " + $xmlmcOutput.status "APIError Returned : " + $xmlmcOutput.error "API Excption Name : " + $xmlmcOutput.exceptionName "API Excption Description : " + $xmlmcOutput.exceptionDescription } else { "An error was returned - here are outputs" "API Call Status : " + $xmlmcOutput.status "APIError Returned : " + $xmlmcOutput.error "API Excption Name : " + $xmlmcOutput.exceptionName "API Excption Description : " + $xmlmcOutput.exceptionDescription } I am running the connection to the API using an API key for my account. I believe this should therefore have the same permissions as what I do via the GUI? Any further ideas? Does this work for you within your instance? Many thanks Ben
  4. Hi Hornbill Integration team! @Ehsan @Steve G I am still struggling with the above issue. I am not able to update using op=update. The API staus is ok so it looks to have submitted. Any ideas? Is this working for others? Are there any special permissions? I can update the fields via the GUI using my account. Thanks Ben
  5. Anyone know why I am not able to use the update method to post data? There is no error but no data is saved on request after post. Thanks
  6. So I have tested the API "update" method Ehsan has kindly suggested. The method accepts the request parameters but does not update the actual details of the SR. I have tried using " requestId" with combination of the following optional parameters "h_summary", "h_description", " h_external_ref_number" and "customFields". Looks like a bug to me as the other request update API mehtods like Hi updateReqTimeline work fine. Maybe an expert like @Steve G can shed some light?
  7. Ehsan Thanks you so much for these pointers. I will give it a go now. Ben
  8. I have a scenario where I would like to post text data capture from a client into a Service Request through the API. At present I would like to use either 1) A request custom attribute to store the data Not sure of what Hornbill Service Manager Requests function is best to do this. or 2) A request activity stream entry with a specific type I have successfully done this using "https://api.hornbill.com/apps/com.hornbill.servicemanager/Requests?op=updateReqTimeline" However, once the data is posted I then want to be able to search / find the values via the API For both scenarios above I am not sure of the correct Requests function to do this. Any assistance would be greatly appreciated. Kind Regards Ben
  9. Hi. When trying to update the sub status of an SR using "Operation - com.hornbill.servicemanager/Requests::smUpdateStatus" I get the following message: API Call Status : fail Error Returned : FlowCode Exception (com.hornbill.servicemanager/entities/Requests/fc_ops/smUpdateSubstatus): nodeName: Set the Output; nodeId: 0a2e4bdf-e634-46a5-afc2-39a985bebbb2; At 264/ 1: "Uncaught TypeError: Cannot read property 'activityId' of undefined" throw(e); _fc_node_exec_0a2e4bdf_e634_46a5_afc2_39a985bebbb2 When trying to update the sub status of an SR using "Operation - com.hornbill.servicemanager/Requests::smUpdateStatus" the sub status does not change and no error is produced. I am however able to successfully change the status of the SR (Open > On Hold > Open). When using this method i submit both Status and Sub Status ID. Any ideas? There does not appear to be much to go wrong within the request. So is this an API bug or a back end configuration issue? Many Thanks Ben
  10. Hi all, I am trying to automate the export of request data and more importantly the responses to questsions using APIs. So far I can get all requests that match search query using : "apps/com.hornbill.servicemanager/Requests" "searchRequests" I can then loop through each request getting various details using : "apps/com.hornbill.servicemanager/Requests" "smGetReqDetails2" This enables me to return the number of questions completed but not the actual responses. Is there another API that has this feature that I can't find? Many Thanks Ben
  11. @Victor You are truely the Hornbill Sith Lord! That's worked perfectly! @AlexTumber - Thanks for your help as well. You got me this far. Maybe the API could benefit from a more descriptive error message for idiots like me?
  12. @AlexTumber the apikey is associated to my account. I am in the Project Portfolio Manager role and also the assigned Project Manager on the project. I have validated access by using the the Web App to locate project and create tasks. yet still not via the API. thanks
  13. @AlexTumber Hi Alex - Let's start with debugging this script (GetProject) as i think the error is likely be related to why my create task fails. Is the syntax of the projectID field valid? I still get an error "API Outcome: failure - the specified project does not exist or you have no access to it" I presume its either a permissions issue or me supplying an incorrect projectID value. The last sems hard to believe as its a only 3 digit value ("277"). Thanks ## Powershell Hornbill XMLMC Module ## Get Single project details from Hornbill instance ## See the API documentation for a full list of supported API input parameters: ## https://api.hornbill.com/apps/com.hornbill.projectmanager/Projects?op=getProject # Import Hornbill XMLMC Powershell Module Import-Module "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\powershellHornbillAPIModule-master\xmlmcModule.psm1" # Define instance connection details & API key for session authentication $hbInstance = "vinci" $hbZone = "eur" $hbAPIKey = "mykeyis here" Set-Instance -Instance $hbInstance -Key $hbAPIKey -Zone $hbZone # Build XMLMC API call Add-Param "projectID" "277" #Add-Param "returnBpmDetails" "1" # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.projectmanager/Projects" "getProject" if($xmlmcOutput.status -eq "ok") { # Confirm if API searched "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "API Status: " + $xmlmcOutput.Status "API Outcome: " + $xmlmcOutput.params.outcome "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "Projects Details: " + $xmlmcOutput.params.projectDetails "Projects BPM Details: " + $xmlmcOutput.params.projectBPMDetails "Projects Risk Details: " + $xmlmcOutput.params.projectRiskWeighting "Projects Total Cost Details: " + $xmlmcOutput.params.projectTotalCost "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } # Important! Remove XMLMC module from memory for security once XMLMC calls complete Remove-Module xmlmcModule
  14. FYI - This is the latest version of the script ## Powershell Hornbill XMLMC Module Example ## Add project task as defined in script to your Hornbill instance ## See the API documentation for a full list of supported input parameters: ## https://api.hornbill.com/apps/com.hornbill.projectmanager/ProjectTasks?op=addProjectTask # Import Hornbill XMLMC Powershell Module Import-Module "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\powershellHornbillAPIModule-master\xmlmcModule.psm1" # Define instance connection details & API key for session authentication $hbInstance ="vinci" $hbZone = "eur" $hbAPIKey = "mykey" Set-Instance -Instance $hbInstance -Key $hbAPIKey -Zone $hbZone # Define Project Tasks details - replace with values from CSV file later $projectID = "277" $TaskName = "this is a test project task" $file = get-content "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\Scripts\statuses.json" # Check the JSON values are correct on screen $JsonOutcomes = $file write-host $JsonOutcomes # Build XMLMC API call to add project task record Add-Param "projectID" "$projectID" Add-Param "name" "$TaskName" Add-Param "outcomes" "$JsonOutcomes" # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.projectmanager/ProjectTasks" "addProjectTask" if($xmlmcOutput.status -eq "ok") { "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" "API Status: " + $xmlmcOutput.Status "API Outcome: " + $xmlmcOutput.params.outcome "New project task ID : " + $xmlmcOutput.params.projectTaskId "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } # Important! Remove XMLMC module from memory for security once XMLMC calls complete Remove-Module xmlmcModule
  15. @AlexTumber Ok the API now responds correctly (thanks). However its not yet able to create a task. It responds with "the specified project task does not exist". If I use the projectID value returned to me within getProject it returns "failure - the specified project task does not exist". So I presume its either a permissions issue or me supplying an incorrect projectID value. The last sems hard to believe as its a only 3 digit value ("277"). The projectID I am using is the value within H_ID returned by during addProject. I am the project manager on the project so should have relevant permissions. Any ideas? Thanks
  16. @AlexTumber I should have spotted it sooner Thats the problem with me pasting code between two script types. Thank you for the assistance ill go give it a try.
  17. @AlexTumber How do I change the path then? This is not a parameter within the script, this is a server side ouput returned by the API. Thanks for your assistance on this!
  18. Alex I had made an assumption that the path is generated as an internal variable in API code controlled by Hornbill? Thanks Ben
  19. Alex I have ammended the JSON to the following for purpose of test [ {"outcome":"completed","text":"Completed","language":"en-GB","buttonColor":"primary","requiresReason":"false"} ] The script has been tweaked to call this so now stands as ## Powershell Hornbill XMLMC Module Example ## Add project task as defined in script to your Hornbill instance ## See the API documentation for a full list of supported input parameters: ## https://api.hornbill.com/apps/com.hornbill.projectmanager/ProjectTasks?op=addProjectTask # Import Hornbill XMLMC Powershell Module Import-Module "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\powershellHornbillAPIModule-master\xmlmcModule.psm1" # Define instance connection details & API key for session authentication $hbInstance ="vinci" $hbZone = "eur" $hbAPIKey = "key in here" Set-Instance -Instance $hbInstance -Key $hbAPIKey -Zone $hbZone # Define Project Tasks details - replace with a CSV loop $projectID = "273" $name = "this is a test project task" $file = get-content "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\Scripts\statuses.json" $JsonOutcomes = $file write-host $JsonOutcomes # Build XMLMC API call to add project task record Add-Param "projectID" "$projectID" Add-Param "name" "$name" Add-Param "outcomes" "$JsonOutcomes" # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.projectmanager/Projects" "addProjectTask" "status code: " + $xmlmcOutput.status "New project task outcome : " + $xmlmcOutput.params.outcome "New project task ID : " + $xmlmcOutput.params.projectTaskId if($xmlmcOutput.status -ne "ok" -or !$xmlmcOutput.params.rowData){ if($xmlmcOutput.status -eq "ok") { "No matching project task records found!" } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } } # Important! Remove XMLMC module from memory for security once XMLMC calls complete Remove-Module xmlmcModule I still recieve "Error Returned : Failed to load FlowCode script '\\?\D:\Hornbill\ESP Server\instances\vinci\apps\com.hornbill.core\entities\Projects\fc_ops\addProjectTask.xml'" Any further ideas? Thanks
  20. Hi. I am trying to ADD / UPDATE project tasks using the various API functions. I receive a similar error for both functions API Call Status : fail Error Returned : Failed to load FlowCode script '\\?\D:\Hornbill\ESP Server\instances\vinci\apps\com.hornbill.core\entities\Projects\fc_ops\addProjectTask.xml' The script i am using for the ADD task is ## Powershell Hornbill XMLMC Module Example ## Add project task as defined in script to your Hornbill instance ## See the API documentation for a full list of supported input parameters: ## https://api.hornbill.com/apps/com.hornbill.projectmanager/ProjectTasks?op=addProjectTask # Import Hornbill XMLMC Powershell Module Import-Module "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\powershellHornbillAPIModule-master\xmlmcModule.psm1" # Define instance connection details & API key for session authentication $hbInstance ="vinci" $hbZone = "eur" $hbAPIKey = "myprivatekeyisinhere" Set-Instance -Instance $hbInstance -Key $hbAPIKey -Zone $hbZone # Define Project Tasks details - replace with a CSV loop $projectID = "273" $name = "this is a test project task" $file = "C:\Users\paddickb\OneDrive - Vinci Construction UK\Hornbill\Scripts\statuses.json" # Get statuses from JSON file ["Active", "Cancelled", "Completed"] $JsonOutcomes = $file $JsonOutcomes = $JsonOutcomes | ConvertTo-Json # check the JSON has been loaded and is correct Write-Host $JsonOutcomes # Build XMLMC API call to add project task record Add-Param "projectID" "$projectID" Add-Param "name" "$name" Add-Param "outcomes" "$converted" # Invoke XMLMC call, output returned as PSObject $xmlmcOutput = Invoke-XMLMC "apps/com.hornbill.projectmanager/Projects" "addProjectTask" "status code: " + $xmlmcOutput.status "New project task outcome : " + $xmlmcOutput.params.outcome "New project task ID : " + $xmlmcOutput.params.projectTaskId if($xmlmcOutput.status -ne "ok" -or !$xmlmcOutput.params.rowData){ if($xmlmcOutput.status -eq "ok") { "No matching project task records found!" } else { # API call status not OK - return status and error to console "API Call Status : " + $xmlmcOutput.status "Error Returned : " + $xmlmcOutput.error } } # Important! Remove XMLMC module from memory for security once XMLMC calls complete Remove-Module xmlmcModule I presume I am doing something wrong? Most likely to do with the validation of the "Statuses"??? The JSON file looks like this [ "Active", "Cancelled", "Completed" ] Any ideas? I really want to be able to resolve this so I can Create / Update project tasks dates and information in bulk using excel. Many Thanks Ben
×
×
  • Create New...