Fetch BP Record List with filter_criteria

POST /ws/rest/service/v1/bp/records/{project_number}

Purpose:

Earlier in REST V1 service, "POST /ws/rest/service/v1/bp/records/{projectnumber}" used "filter_condition" to filter the BP records. Only '=' (equal) condition was supported for Data Elements 'end_date','record_no' and 'status'"

filter_condition

{

"bpname" : "Vendors",

"lineitem" : "yes",

"lineitem_fields" : " uuu_tab_id;title",

"filter_condition" : "status=Active",

"record_fields" : "uuu_user_id;uuu_record_last_update_date"

}

Enhancing BP Record list V1 REST API to support for filters like:

To support the new BP filters, new "filter_criteria" should be added in POST data.

filter_criteria

{

"bpname" : "Vendors",

"lineitem" : "yes",

"lineitem_fields" : "uuu_tab_id;title",

"record_fields" : "uuu_user_id;uuu_record_last_update_date",

"filter_criteria":{

"join":"OR",

"filter":[

{

"field":"record_no",

"value":"VEN",

"condition_type":"like"

},

{

"field":"uuu_file_title",

"value":"first document title",

"condition_type":"like"

},

{

"field":"uuu_file_issue_date",

"value":"12-07-2017 07:54:00",

"value2":"20-07-2018",

"condition_type":"range"

}

]

}

}

filter_criteria key Definitions:

  1. The "join": (optional) Specify if the filter condition has to be combined using OR or AND operator. Default is AND.
  2. The "filter": List of filter conditions. Each condition will have "field", "value" ("value2" if condition_type is range) and condition_type.
    • The "field": BP form DE name for which the filter condition has to be applied.
    • The "value": value for the DE to filter the data.
    • The "value2": second value for the range condition. Not required to be specified for other conditions.
    • The "condition_type": the filter condition that needs to be applied.

Possible value for condition_type:

condition_type

Notes

Supported Data Element Types

like

For string data types. The value can contain the SQL wildcard characters when like is specified.

Text (String)

eq

For string, numeric and date data type. Will perform the exact match.

Text (String), Number, Cost, Date

lt

For numeric values. Will perform less than value.

Number, Cost, Date

gt

For numeric values. Will perform greater than value.

Number, Cost, Date

lteq

For numeric values. Will perform less than or equal value.

Number, Cost, Date

gteq

For numeric values. Will perform greater than or equal value.

Number, Cost, Date

neq

For numeric values. Will perform not equal value.

Text (String), Number, Cost, Date

range

Numeric, Date values. Will perform range search between value (from) and value2 (to).

Number, Cost, Date

Note: The Input Date fields should be provided in "MM-dd-yyyy HH:mm:ss" or ""MM-dd-yyyy" format in filter_criteria.

Additional notes:

Output:

JSON object containing 'status', 'data', 'message'

A message will be present if status is not 200 otherwise it will be "success".

Sample Response of Get BP list after applying filter_criteria

{

"data":

[

{

"uuu_user_id":"a@abc.com",

"uuu_record_last_update_date":"2018/04/23 11:06",

"_bp_lineitems":

[

{

"uuu_tab_id":"List of Contacts",

"li_num":1,

"title":"t"

}

],

"record_no":"VEN-0023"

},

{

"uuu_user_id":"a@abc.com",

"uuu_record_last_update_date":"2018/05/28 04:34",

"_bp_lineitems":

[

{

"uuu_tab_id":"List of Contacts",

"li_num":1,

"title":"t"

},

{

"uuu_tab_id":"List of Contacts",

"li_num":2,

"title":"t"

}

],

"record_no":"VEN-0024"

}

],

"message":

[ "success"

],

"status":200

}



Legal Notices | Your Privacy Rights
Copyright © 1998, 2022

Last Published Tuesday, February 8, 2022