It's all about the answers!

Ask a question

Using REST on RTC, how do you query for a null or empty or unassigned field? What is the syntax?


Glenn Henderson (645) | asked Oct 16 '14, 7:18 p.m.
Trying to create a REST query for RTC and return all workItems where the "foundIn" field is null / empty / unassigned.

What is the syntax of the REST URL for querying on a field that was never set by the user?  With other REST tools, it's "is Null" or "is Empty"

One answer



permanent link
Eric Jodet (6.3k5111120) | answered Oct 17 '14, 5:31 a.m.
JAZZ DEVELOPER
 Hello Glenn,
you may use Firefox and Firebug - Net tab

Run a new / unsaved query with the params you need,
in Firebug, locate the call POST IQueryRestService#getResult()
check the Post tab and locate the Json values we pass:
jsonExpression:
{"operator":"AND","attributeExpressions":[{"attributeId":"foundIn","operator":"is not","values":["","_kRe6II6GEeOuIeSMwSQQhw" ],"variables":[]}],"termExpressions":[],"similarityExpressions":[]}

Assuming that value  _kRe6II6GEeOuIeSMwSQQhw
correspond to "Unassigned"

(I would rather use OSLC - https://jazz.net/wiki/bin/view/Main/WorkItemAPIsForOSLCCM20)

Hope it helps,
Eric

Comments
Glenn Henderson commented Oct 17 '14, 8:00 a.m.

"Unassigned" is a null / empty entry.  The JsonExpression for an "unassigned" (null) entry is value: [""].  When putting [foundId=''] (single quotes) into the REST URL, RTC responds with

ERROR 500: CRRED0105E:  Unsupported type name: com.ibm.team.workitem.Deliverable

There should be some secret keyword for searching for null field values.  I would hate to have to reverse the logic and "is not" all of the possible values.


Glenn Henderson commented Oct 17 '14, 8:01 a.m. | edited Oct 17 '14, 8:10 a.m.

Double Posting - But couldn't find how to delete this.


Eric Jodet commented Oct 17 '14, 8:30 a.m. | edited Oct 17 '14, 8:30 a.m.
JAZZ DEVELOPER

Glenn,

k - re-tested:
_kRe6II6GEeOuIeSMwSQQhw is the internal value of "None"
 "" is for "Unassigned"

The expected syntax of the JsonExpression is not [foundId=''] 
The syntax of the JsonExpression we pass from the WebUI to the server is:
{"attributeExpressions":[{"attributeId":"foundIn","operator":"is","values":[""],"variables":[]}],"termExpressions":[],"similarityExpressions":[],"operator":"AND"}

Eric

Your answer


Register or to post your answer.