Add Watcher - Rally Rest API

507 views Asked by At

How to "Add Watcher" using Rally Rest API? I am unable to locate any keywords "watch", "watcher" or reference to watcher in documentation

Edit 1: Based on Joshua's answer I have tried the below:

DynamicJsonObject watcherToBeAdded = new DynamicJsonObject();
DynamicJsonObject watcherResult;
watcherToBeAdded["UserUUID"] = User's UUID;
watcherToBeAdded["ArtifactUUID"] = Story's UUID;
watcherToBeAdded["zuul_key"] = rallyAPIKey;
watcherResult = restApi.Post("notifications/watch", watcherToBeAdded);

This led to method not allowed.

I have also tried:

string rallyRef = "https://rally1.rallydev.com/notifications/api/v2/watch";
DynamicJsonObject toUpdate = new DynamicJsonObject();
toUpdate["ArtifactUUID"] = StoryUUID;
toUpdate["UserUUID"] = UserUUID;
OperationResult updateResult = restApi.Update(rallyRef, toUpdate);

This is throwing the below exception: Value cannot be null Parameter name: key

1

There are 1 answers

3
joshuaegclark On

Authentication:

All requests to must be authenticated with a valid zsessionid or Rally API Key. You can pass this in a few ways:

As a header: zuul=[ZSESSIONID] or zuul=[RALLY_API_KEY]

As a cookie: ZSESSIONID=[ZSESSIONID] or ZSESSIONID=[RALLY_API_KEY]

As a query parameter: zuul_key=[ZSESSIONID] or zuul_key=[RALLY_API_KEY]

To add a "watch", you can send a request like:

Method: POST
Url:    https://rally1.rallydev.com/notifications/api/v2/watch
Body: 
{
  UserUUID: <ObjectUUID of user to be added as watcher,
  ArtifactUUID: <ObjectUUID of artifact to be watched>
}

To remove a watch, you can send a request like:

Method: DELETE
URL: https://rally1.rallydev.com/notifications/api/v2/watch?ArtifactUUID=<ObjectUUID of artifact>&UserUUID=<ObjectUUID of User to remove as watcher>