why contains keyword is not working on rally api query

229 Views Asked by At

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.

2

There are 2 best solutions below

0
Sanjay On BEST ANSWER

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)));
0
Kyle Morse On

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.