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