2

I am trying to query on rally api by using below

req.Query = new Query("User.ObjectID", Query.Operator.Equals, loggedinUser.ToString()).And(new Query("Role", Query.Operator.Contains, Role).And(new Query("Workspace.ObjectID", Query.Operator.Contains, workspaceID)).And(new Query("Project.ObjectID", Query.Operator.Equals, projectObjectID)));

But it is throwing error as

The operator [ contains ] is not supported for this attribute type. The available operators are [ =, !=, >, <, >=, <=, in ]

is it contains key word is deprecated? please help me alternative in such case.

Sanjay
  • 1,226
  • 3
  • 21
  • 45

2 Answers2

2

You can't use contains for an object id- that attribute is numeric. contains is reserved for strings and collections.

It's the Workspace.ObjectID specifically that's ruining your day. Change it to equals and you should be good to go.

Kyle Morse
  • 8,390
  • 2
  • 15
  • 16
1

As per https://communities.ca.com/thread/241816885-why-contains-keyword-is-not-working-on-rally-api-query?et=watches.email.outcome

contains no longer supports in such type of queries but previously it is worked.

Its working when I replaced 'Contains' with 'Equals' as

 req.Query = new Query("User.ObjectID", Query.Operator.Equals, loggedinUser.ToString()).And(new Query("Role", Query.Operator.Equals, Role).And(new Query("Workspace.ObjectID", Query.Operator.Equals, workspaceID)).And(new Query("Project.ObjectID", Query.Operator.Equals, projectObjectID)));
Sanjay
  • 1,226
  • 3
  • 21
  • 45