REST2 - Linking tickets


#1

How can I make a ticket a member of another ticket via REST2? For example, I want to make ticket #002 to be a child of ticket #001. With REST1 it is done with /ticket/-ticket-id-/links, but I can’t find any info on it in REST2 manual. I can see the _hyperlinks to linked tickets in the tickets already created with web interface, but can’t seem to create a new link. Any suggestions?


#2

Did you ever find a way to do this either via the API or other mechanisms? We are trying to automatically link assets to tickets but I have not found a way to do it without manually going through the pages.


#3

Sadly, we did not. Seems that the feature is not yet implemented and by the looks of it, it isn’t on highest priority list.


#4

That’s too bad. It’s a feature we would use too. Right now, we are still primarily using a python library to the REST1 API but looking to start switching over to REST2.


#5

I have two patches for this, used on production RT instance, but no push request at this time (needs to discuss this with BPS and provide doc).

Here are the patches, but you may need to manually apply them as they are already on top on an extented RT REST2 API …


#6

And the way to use it:

curl -X PUT \
-H "Content-Type: application/json" \
-H "Authorization: token $token" \
-d '{ "AddLink": [ { "type": "MemberOf", "base": B } ] }' \
$base_uri/REST/2.0/ticket/A

#7

Does it work for assets as well?


#8

So in theory you could do…
{ “AddLink”: [ { “type”: “external”, “base”: “asset://…/100”, “ref” : “refers”: “refers-to” }] }

To add an asset to a ticket?


#9

Any thoughts here on if this is the right way or if I am totally misunderstanding.