Skip to main content

GetReportDataByConditions

Get report data by conditions

Description

Obtain report data by specifying conditions

Method

POST

Request URL Format

/api/v0/applications/:app-id/reports/:report-id/filter

Payload


// Specify search conditions
"conditions" : [] //Specify search conditions
// "id": Specify the display_id of the DataReport field or "rpf_id" (the report field ID returned by the /conditions API)
// "search_value": Specify search conditions as an array (see sample) *Similar to the specification of an item list, the specification contents differ for each field type

// Pagination
"per_page" : 10 // Number of acquisitions per page 
"page" : 1 // Number of pages

// Specify sort order (specify multiple sort keys)
"sort_fields": [
{"id": "Status", "order": "desc"}, // For id, specify display_id or rpf_id 
{"id": "Category", "order": "asc"} // order specifies sort order desc : descending ask : ascending (If omitted, ascending order is used.)
],

// Specify sort order (single sort key specification) *If "sort_fields": [] is specified, this specification is ignored (sort_fields takes precedence)
"sort_field_id": "No", // Specify display_id or rpf_id
"sort_order": "desc", // Specify asc or desc

// To include creation and modification dates in the search results, specify the following: The creation and modification dates of the data specified as the data source will be included in the results. (When merging related items, the creation and modification dates of the related items are not included.)
"include_date_at": true,

// To include the value of the database (Lookup) item in the search results, specify the following.
"include_lookups": true, // default false

// To include the ID (d_id, i_id,rev_no) of the field's referring Item in the search results, specify the following:
"include_item_ref": true, // default false

// To include ID and Value values related to choice type, status, and user in the search results, specify the following
"return_id_value_results": true, // default false

// "include_lookups": If true and the numeric type data of the referenced Item is to be output as Number, specify the following (by default, the number is returned as a string ("123"))
"return_number_value": true,

// Only totalItems (number of hits) is returned. null is returned for report_results.
"return_count_only": true, // default false

// For date-type fields, the return value is returned in UTC time (ISO format). However, if this setting is turned on in the HexabaseUI report settings, UTC is used regardless of the flag specification. This setting is valid only for the date type (not the Datetime type).
"return_utc_datetime" : true

// Specifies the timeout period in seconds for a totalItems search. If a timeout occurs, totalCount returns -1.
"total_count_timeout_sec": 10 // default 60(s)

// data_result_timeout_sec Allows specifying the number of seconds for timeout when getting report_results. If timeout occurs, report_results will be omitted (null).
"data_result_timeout_sec": 20 // default 60(s)

// Omit the totalItems calculation; totalItems will always return 0. This is especially important when the amount of data is large. Improves the processing speed of search results.
"omit_total_items": false, // default false


// The "report_fields" part can be omitted from the acquisition results (to reduce data volume when report_fields information is not needed).
"omit_fields_data" : true,

// To obtain results in CSV format, specify "csv" (if omitted, JSON format is used)
"format": "csv"

(Note 1: Specify sort_fields when using per_page.)

Request URL Sample

POST https://api.xxx.com/api/v0/applications/APP_ID/reports/REPORT_ID/conditions

Payload Sample

When using the display ID as a search condition

id: to specify the field ID.

{
"conditions":[
{ "id":"CATEGORY", "search_value":["B"] } // Narrow down to only those with data value B in the CATEGORY column
],
"sort_fields": [
{"id": "Status", "order": "desc"},  // Sort key 1
{"id": "Category", "order": "asc"} // Sort key 2
],
"per_page" : 10,
"page" : 1
}

When using field IDs for reporting

rpf_id: to the report field ID

{
"conditions":[
{
"rpf_id":"4552a666-508d-419c-ba99-7c9a16b24894", // Filter by specific column value
"search_value":["B"]
}
],
"sort_field_id": "No", // No Sort by column
"sort_order": "desc", // Descending order
"format": "csv" // Output in CSV format
// Omit per_page= output all cases
}

Response Sample

See GetReportData for a sample of normal results.

※ The JSON format is the same as the data report acquisition sample.
 format="csv", the first line is the header line, and the second and subsequent lines output data separated by commas.

"include_lookups": If true is specified

"lookup_items" The item information of the corresponding database reference (Lookup) will be expanded in the field.

In cases where the Lookup destination Item recursively references its own Item, it is expanded up to twice, but no further calls are made (to avoid infinite loops).

{
"report_fields": [
// (Omitted) // omit_fields_data : If true is specified, this "report_fields" can be omitted.
],
"report_results": [
{
"ChildID": "3",
"LookupMySelf": "タスクE", // Lookup type 1
"Status1": "確認",
"Status2": "完了",
"Title": "TaskD",
"Title2": "タスクE",
"created_at": "2020/08/16 11:59:45",
"items": [
{
"d_id": "5f38a11baa395581685afdb4",
"i_id": "5f38a121aa395581685afdc1"
}
],
"lookup_items": {
"LookupMySelf": { // Item values of Lookup type 1
"Assignee": "X",
"Category": "B",
"DueDate": "2015-12-31T15:00:00Z",
"LookupMySelf": "3", // Item values of Lookup type 1 (LookupField in the Lookup Item)
"Status": "完了",
"Title": "タスクE",
"created_at": "2020-08-16T04:06:14Z",
"created_by": "IMPORT",
"d_id": "5f38b0afaa395581685afdf6",
"i_id": "5f38b0b6aa395581685afdff",
"lookup_items": {
"LookupMySelf": { // Item values of Lookup type 1 (Recursive Link... )
"Assignee": "X",
"Category": "B",
"DueDate": "2015-12-31T15:00:00Z",
"LookupMySelf": "4", // Recursive call will be limited by twice for the same datastores in the result
"Title": "タスクE",
"created_at": "2020-08-16T04:06:14Z",
"created_by": "IMPORT",
"d_id": "5f38b0afaa395581685afdf6",
"i_id": "5f38b0b6aa395581685afdff",
"p_id": "5f25956528dc5c55b463bc7b",
"rev_no": "4",
"status_id": "5f38b0afaa39558bfca2963c",
"title": "タスクE",
"updated_at": "2021-01-22T17:10:37Z",
"updated_by": "5f25952c28dc5c55b463bc76"
}
},
"p_id": "5f25956528dc5c55b463bc7b",
"rev_no": "4",
"status_id": "5f38b0afaa39558bfca2963c",
"title": "タスクE",
"updated_at": "2021-01-22T17:10:37Z",
"updated_by": "5f25952c28dc5c55b463bc76"
}
},
"updated_at": "2020/09/30 23:04:30"
}
],
"report_title": "LookupJoin",
"error": "",
"totalItems": 9,
"item_index_from": 0,
"item_index_to": 0
}

"return_id_value_results": If true is specified

Adds ID and Value map information for each field of choice type (Select, Radio, Checkbox), status type, and user type.

{
"report_fields": [
// (Omitted) // omit_fields_data : If true is specified, this "report_fields" can be omitted.
],
"report_results": [
{
{
"AssigneeText": "Y",
"Category": "B",
"DueDate": "2016/01/01",
"Lookup1": "",
"Number": 5,
"TextArea": "aあああ",
"Title": "タスクA",
"UserType": "hi__test2",
"i_id": "5f267f1628dc5c6988bc2ff2",
"id_value_results": { // <---- If the appropriate field has a choice type, status, or user type, it will be appended.
"Category": {
"id": "B",
"value": "B"
},
"UserType": [
{
"id": "6028ed8628dc5c0e38b86c22",
"value": "hi__test2"
}
],
"status1": {
"id": "Assigned",
"value": "Assigned"
}
},
"rev_no": 6,
"status1": "Assigned"
},
{
"AssigneeText": "X",
"Category": "A",
"Checkbox": "22",
"DateOld": "2021/05/26",
"DateTime1": "2021-05-27T18:38:13Z",
"DueDate": "2016/01/22",
"Lookup1": "",
"Number": 11,
"Radio": "B",
"Title": "タスクE",
"UserType": "",
"i_id": "5f267f1628dc5c6988bc2fee",
"id_value_results": { // <---- Appended to the appropriate field if it has a choice type, status, or user type
"Category": {
"id": "A",
"value": "A"
},
"Checkbox": [  // <---- In the case of a checkbox, an array of multiple choices is returned
{
"id": "3ce8c186-89a6-455c-8b80-f962333b3eb0",
"value": "22"
}
],
"Radio": {
"id": "OptionB",
"value": "B"
},
"status1": {
"id": "InReview",
"value": "In Review"
}
},
"rev_no": 24,
"status1": "In Review"
},
{
"AssigneeText": "Y2",
"Category": "A",
"DateOld": "2021/05/18",
"DateTime1": "2021-05-26T18:47:51Z",
"DueDate": "2016/01/01",
"Lookup1": "タスクE",
"Number": 45,
"Radio": "A",
"Title": "タスクXXX",
"UserType": "hi-hexabase, hi__test3",
"i_id": "5f267f1628dc5c6988bc2ff1",
"id_value_results": { // <---- If the appropriate field has a choice type, status, or user type, it will be appended.
"Category": {
"id": "A",
"value": "A"
},
"Radio": {
"id": "OptionA",
"value": "A"
},
"UserType": [  // <---- In the case of User type, an array of multiple choices is returned
"id": "5f25952c28dc5c55b463bc76",
"value": "hi-hexabase"
},
{
"id": "5fb20308aa39557714afd53a",
"value": "hi__test3"
}
],
"status1": {
"id": "IN_PROGRESS",
"value": "In Progress"
}
},
}
],
"report_title": "TestReport",
"error": "",
"totalItems": 3,
"item_index_from": 0,
"item_index_to": 2
}

Errors

If the search for totalItems times out

{
"report_results": [
...(省略)
],
"report_title": "ReportTitle",
"error": "error totalItems count process timeout. (3 sec elapsed)",
"totalItems": -1,
"item_index_from": 0,
"item_index_to": 4
}