Help setting Owner for REST API with curl

Hello. Although using ‘curl’ may not be entirely accurate it’s the closest approximation I can make–I’m using a webservice API in another program to create tickets. I’ve got everything worker except the owner. No matter what I do, I can’t get it to set an owner.

Since I’m only testing things out, I have the content part being sent to be pretty simple and largely hardcoded.

id: ticket/new (tested, works)
Requestor: (tested, works)
Subject: (variable, tested, works fine)
Priority: (variable, tested, works fine)
Text: (whatever they want, tested, works fine)
Queue: TAS Provisioning Team (tested, worked after a lot of heartache. Apparently this has to go on the bottom of the content being sent over curl to work.)

Everything works fine except no matter what I do, the Owner is always nobody. I looked up my user information and that is set as my “Name” in the system, but I’ve tried it with my “Real Name” and that didn’t work either. My email is the same as my “Name.”


Depending on your RT version you might have hit a bug with line break parsing: Set Owner in Create Ticket using API

There are other hints within this thread:

Some hints:

is andrew a Name of an RT user
is andrew account enabled
as andrew OwnTicket right on queue “desk”
what if you user Owner instead of owner
what if you use unix line breaks (%0A) instead of %0D%0A

Bye, Daniel

Hi Daniel. Any suggestions on how to do line breaks? The program I’m using a paragraph-line-break style symbol to actually split up the lines.

I have done exactly the same as you have and it works fine for me. However, my owner field is that of a registered user of the RT system and not an email address (we deliberately did not give our user an email address). I have also had to write a simple jacket program to create the parameter file as it prefers the unix style line-feed terminated strings not the windows carriage-return/line-feed.

Note all this is done on a Windows machine.

rem : rt_addline adds a line with only a LF line terminator specifically to param.file
rt_addline “ticket/new”
rt_addline “Requestor: %RT_FROM%”
rt_addline “Cc: %RT_FROM%”
rt_addline “Owner: %rt_user%”
rt_addline “Subject: %title%”
rt_addline “Text: Ticket created”
rt_addline “Queue: %rt_queue%”

curl -F “content=<%par%” “%rt_server%?user=%rt_user%&pass=%rt_pass%” -s --insecure --output curl.txt

Failing the above not working, try to edit the ticket

your_server = https://%RT_SYSTEM%/REST/1.0/ticket/ticket_number/edit

parameter file
id: 12345

curl call
curl -F “content=<%par%” “%rt_server%?user=%rt_user%&pass=%rt_pass%” -s --insecure --output curl.txt

hpwady, thank you so much! After trying a few different things I decided to go with your solution of editing the ticket immediately after creation.