2

我正在尝试使用以下方法查询拉力赛 api

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)));

但它抛出错误

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

是否包含关键字已弃用?在这种情况下,请帮我替代。

4

2 回答 2

2

您不能contains用于对象 id-该属性是数字的。 contains为字符串和集合保留。

正是 Workspace.ObjectID 破坏了你的一天。将其更改为equals,您应该一切顺利。

于 2018-10-16T21:19:41.640 回答
1

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

contains 不再支持此类查询,但以前可以使用。

当我将 'Contains' 替换为 'Equals' 作为

 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)));
于 2018-10-18T06:39:29.013 回答