Field API: Issues Search with Two Conditions

Q. I would like to search issues with two conditions combined using this:

POST /fieldapi/issues/v1/search

For example, I want Safety Issues that were created on or after September 1, 2016.

I am able to search on a single condition. The documentation suggests like this:

"[\"cf--5bf288e4-21a0-4fe8-9a4b-67c8133fcb92,like,\\\"inspect\\\"\",\"f--status,in,[\\\"Work Completed\\\",\\\"Draft\\\"]\"]"

but I can’t get anything that resembles this to work.

A. The documentation is correct, but it probably needs a little clarification. Quotation marks (“”) and escape makes (\) make it difficult to tell the logic behind it.

A condition is defined as a string of a form:

Condition = field_identifier,operator,”condition_value”

Notice that condition_value is wrapped with quotation marks (“”). As an example, let’s say, we have two conditions A and B as follows:

Condition_A = created_at,geq,\"2015-01-01\"
Condition_B = f--issue_type_id,eq,\"98f6738e-97ce-11e2-a4be-02cc3afa57bd\"

Then conditions parameter is defined as a list ([]) of each condition separated by comma (,).

conditions = [“condition_A”,”condition_B”]

Notice that I’m wrapping each condition with quotation mark (“”), which makes each condition as one string.

Putting together, the conditions parameter looks like this:

conditions = ["created_at,geq,\"2015-01-01\"","f--issue_type_id,eq,\"98f6738e-97ce-11e2-a4be-02cc3afa57bd\""]

Depending on the tools and programming language you are using, you may further need to elaborate with escape character while passing the parameter to your actual REST call.

For topics related to search issues, please take a look the follow posts:

Mikako

Advertisements

2 thoughts on “Field API: Issues Search with Two Conditions

  1. Daniel Frohardt

    How would I search for issues for a specific day (not greater than or equal to)? When trying to use ‘eq’ in my conditions parameter I don’t return any results, but ‘geq’ returns issues on my particular date as well as issues later than my date.

    Like

  2. Hi Daniel,

    Just tried it myself. “eq” also works. However, I notice that “created_at” is actually a time. So if you use the condition that includes time, it finds a matching one, e.g.,
    [“f–created_at,eq,\”2016-01-10 14:42:01 -0500\””]
    This means that if you are interested in a specific date, you should use a combination of “geq” and “leq”.
    I will add a note about this to my post.
    I hope this explains.

    By the way, in future, please the BIM 360 API forum for any questions:
    http://forums.autodesk.com/t5/bim-360-api-forum/bd-p/115

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s