REST2 - Linking tickets

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?

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.

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.

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.

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 …

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

Does it work for assets as well?

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

To add an asset to a ticket?

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

Very late reply …

I just tested with my patch and this lines works if you want Asset A to ReferTo Ticket B:

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

be sure to replace $Organization with yout configuration value