WSAPI: Create an artifact with a tag using WSAPI
search cancel

WSAPI: Create an artifact with a tag using WSAPI

book

Article ID: 92716

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

Can we use the WSAPI to create an artifact with a tag?

Creating an artifact and associating it with a tag is possible using WSAPI. This document demonstrates how to do that for a Defect. Similarly it can be done with any other artifact.

Environment

Release:
Component: ACSAAS

Resolution

In order to create an artifact with a tag , you will need to have a tag already created. 

Step 1: find the ObjectID of your tag
You should use the Query operation using your tag's Name and value. In this example we used the WSAPI help pages. You can use any other utility that lets you make REST calls to this endpoint.


The result will return the Tag object. You will need to find the ObjectID. This screen shot is the returned screen of our former query where the ObjectID is highlighted.


Step 2: Create your artifact and associate it with the tag.
Make a 'create' call to the endpoint of your artifact. The JSON body can include an array called: "Tags". Use that array to include all references to the tags you are associating with this artifact. In this example we use the reference to our tag , using the _ref property.
Here we create a Defect , but a similar idea is for all other artifacts.

 

Check out your result. Below you see a 200 OK return code and the JSON returned contents. See the _refObjectName that holds the name of the artifact you created.


Step 3:  Let's confirm in Rally that the artifact was created and associated with the tag.

At bottom right of next screen you can see the tag that's associated with this artifact. "MyTag" indeed was the tag we used in Step 1 to associate with this artifact.