4 Replies Latest reply on Jun 18, 2015 5:39 AM by capetownandre

    Powershell   rest api update custom field

    capetownandre

      Hi

       

      I am battling to get to grips with the rest api.

      I am using the below PowerShell script which does not throw any exceptions

      can anybody shed some light on my dilemma

       

      The full story:  { I am using powershell to identify status changes in Web help Desk database, and create issues in JIRA for my KANBAN board ( Via the rest api) the response from Jira is the issue number Just created,

      I now want to update Web Help Desk "ticket custom field"   with this JIRA ticket Number.}

      any help appreciated

      Thanks

       

      $definitionId = "33"

      $restValue = "E1245"

      $uri = http://10.5.67.159/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/36566/?username=Andren&password=zzzzzz


      $body = @{

        definitionId=$definitionId

        restValue=$restValue

         $jsonBody = ConvertTo-Json $body

         $resp =  Invoke-RestMethod -uri $uri -Method Put -body $jsonBody -ContentType "application/json" 

           $cat = $resp.id

          write-host " key = $resp.id"

      ------------------------

      after execution returns The Id of the ticket as expected, but no update happens


      I get the info I deem necessary from this command line in chrome, I also use to inspect if my update has worked


      http://103.52.67.159/helpdesk/WebObjects/Helpdesk.woa/ra/Tickets/36566/?username=Andren&password=xxxxxx


      which returns details of the ticket to viewing pane  Ticket id = 36566

      {"id":36566,"type":"Ticket","bccAddresses":null,"ccAddressesForTech":null,"departmentId":null,"lastUpdated":"2014-11.................":"TicketCustomField","definitionId":31,"restValue":"23333"},{"id":15947,"type":"TicketCustomField","definitionId":32,"restValue":"Accounting / Financials"},{"id":18080,"type":"TicketCustomField","definitionId":33,"restValue":"233332"},{"id":