APIs that searches, how body is constructed?

Monday, October 17, 2022
Avatar

There are APIs that allows search. Example:

POST: projects/{project_id}/incidents/search?start_row={start_row}&number_rows={number_rows}&sort_by={sort_by}

Description

Searches the list of incidents in the project. This operation allows you to specify a list of filters, the sort column (optional) and the pagination range.

 

Several questions:

  • What to send in a body to let it filter by custom fields? For example, I have a custom field with multiple list values (major releases where a fix was deployed) and I need to get incidents that have "QA" and not "Prod" there? In other words I am preparing release notes and would like to see the defference between Prod (was not deployed there) and QA (was deployed there).
  • How to write OR logic in a body? Example: I need requirements with status "Requested" or "Design approval"?
3 Replies
Thursday, October 20, 2022
Avatar
re: ilyapolyakov Monday, October 17, 2022

Hi Ilya

In general, the body to post for filtering is an array of multiple  individual filter clauses that are ANDed. Then for a custom property that has multiple values, you can have a list of possible matching values that are ORed.

Something like:

[
 {
  "PropertyName": "Custom_01",
  "MultiValue ": [1,3,4]
 },
 {
  "PropertyName": "Custom_02",
  "MultiValue ": [2,8,10]
 }
]

I'd log a support ticket for more specific assistance.

Regards

David

Monday, October 24, 2022
Avatar
re: inflectra.david Thursday, October 20, 2022

Hi, David,

Thanks for the answer!

Is it possible to construct next logic inside custom property to receive where custom property  multilist has "1" but not "2"?

Thursday, December 15, 2022
Avatar
re: ilyapolyakov Monday, October 24, 2022

I need a filter, that filters requirements by Component AND "Requested Release" (our custom field).

 

I have tried next bodies, but it doesn't work as AND logic.

[
{"ComponentId": 446,
"PropertyName": "Requested Release",
"IntegerValue ": 2630
}
]
[
{"ComponentId": 446},
{
"PropertyName": "Requested Release",
"IntegerValue ": 2630
}
]

What should I change there? 

 

Thanks!

Spira Helps You Deliver Quality Software, Faster and With Lower Risk

And if you have any questions, please email or call us at +1 (202) 558-6885

 

Statistics
  • Started: Monday, October 17, 2022
  • Last Reply: Thursday, December 15, 2022
  • Replies: 3
  • Views: 468