-
Re: Powershell rest api update custom field
ben.ricardo Feb 4, 2015 5:14 PM (in response to capetownandre)Ha! Battling is the term to use with the rest api that's for sure!
We do exactly what you're trying to do with our custom written Job management program.
The relevant bits from my post on this (API integration with WHD) for your question are:
--snip--
We also wanted to be able to update the ticket custom field with the new job number from our system (you can see the ticket number I was experimenting with was 115 and the json file containing the new field value is called test.json)
Invoke-RestMethod "http://helpdeskURL/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/115?&apiKey=keygeneratedundertechaccount" -InFile test.json -Method Put
Contents of the test.json file looks like this (custom field ID is 13, Job number to be inserted E12345)
{"customFields": [ {"definitionId": 13, "restValue": "E12345"}]}
--snip--
Hope this helps
Ben
-
Re: Powershell rest api update custom field
capetownandre Jun 18, 2015 4:32 AM (in response to ben.ricardo)Hi I had forgotten about this, I did manage to get a script kinda working, bet then stopped using Jira as our Kanban Board.
I have attached a skeleton of what I did in the chance it may help someone.
I used a task schedule to run a powershell script every now and then, this queried a custom table I had placed in WHD ( Trigger off a field of the ticket when filed changed) I used an .ini file to supply all run parameters something like below
############################################################
## configuration file for Jira reporting from WHD
##
## Double Hash ## in line disables the line content
##
##
############################################################
#Server - yourserverip
#User - suername
#DB_Name - whd
#pword - password
#Log_File - C:\WHD\log\whd_Log.txt
#Template - C:\WHD\Report\WHD_TEMPLATE_02.xlsx
#workDir - C:\WHD\Work
## #SMTPserver - smtpserverip -for production machine
#SMTPserver - smtp.testip -testing on za domain## a list of area's and associated Users that should be processed
## lemail adress seperated by comma's in one line# #Area_User_list : xxxxxxx@melitan.co.za ,yyyyyyyE@melitan.co.za
script a bit long but attached a link
--snip--
JIRA_CREATE_ISSUE_ex.ps1 - Google Drive
--snip--
-
Re: Powershell rest api update custom field
doughall2015 Jun 18, 2015 5:11 AM (in response to capetownandre)Your API Key was visible Be careful.
-
Re: Powershell rest api update custom field
capetownandre Jun 18, 2015 5:39 AM (in response to doughall2015)Thanks
had just removed all references and uploaded the old file
-
-
-