Python
client.query.create_query_insight_v2026_r0(
CreateQueryInsightV2026R0Query(
predicate=predicate,
params={"minAmount": 0},
ancestors=[QueryAncestorReferenceV2026R0(id="0", type="folder")],
group_by=[
QueryInsightsGroupByV2026R0(
field="".join([md_prefix, ".category"]), bucket_limit=5
)
],
),
metrics,
)await client.query.createQueryInsightV2026R0({
query: {
predicate: predicate,
params: { ['minAmount']: 0 },
ancestors: [
{ id: '0', type: 'folder' } satisfies QueryAncestorReferenceV2026R0,
],
groupBy: [
{
field: ''.concat(mdPrefix, '.category') as string,
bucketLimit: 5,
} satisfies QueryInsightsGroupByV2026R0,
],
} satisfies QueryInsightsRequestBodyV2026R0QueryField,
metrics: metrics,
} satisfies QueryInsightsRequestBodyV2026R0);try await client.query.createQueryInsightV2026R0(requestBody: QueryInsightsRequestBodyV2026R0(query: QueryInsightsRequestBodyV2026R0QueryField(predicate: predicate, params: ["minAmount": 0], ancestors: [QueryAncestorReferenceV2026R0(id: "0", type: "folder")], groupBy: [QueryInsightsGroupByV2026R0(field: "\(mdPrefix)\(".category")", bucketLimit: 5)]), metrics: metrics))client.getQuery().createQueryInsightV2026R0(new QueryInsightsRequestBodyV2026R0(new QueryInsightsRequestBodyV2026R0QueryField.Builder(predicate).params(mapOf(entryOf("minAmount", 0))).ancestors(Arrays.asList(new QueryAncestorReferenceV2026R0("0", "folder"))).groupBy(Arrays.asList(new QueryInsightsGroupByV2026R0.Builder(String.join("", mdPrefix, ".category")).bucketLimit(5).build())).build(), metrics))await client.Query.CreateQueryInsightV2026R0Async(requestBody: new QueryInsightsRequestBodyV2026R0(query: new QueryInsightsRequestBodyV2026R0QueryField(predicate: predicate) { Parameters = new Dictionary<string, object>() { { "minAmount", 0 } }, Ancestors = Array.AsReadOnly(new [] {new QueryAncestorReferenceV2026R0(id: "0", type: "folder")}), GroupBy = Array.AsReadOnly(new [] {new QueryInsightsGroupByV2026R0(field: string.Concat(mdPrefix, ".category")) { BucketLimit = 5 }}) }, metrics: metrics));{
"insights": [
{
"key": [
"ContractType1"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 180000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 245
}
}
}
},
{
"key": [
"ContractType4"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 100000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 185
}
}
}
},
{
"key": [
"ContractType2"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 200000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 150
}
}
}
},
{
"key": [],
"type": "other",
"metrics": {
"totalCountBeyondTopGroups": {
"type": "count",
"values": {
"count": 165
}
}
}
}
]
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}クエリ
Boxの項目に関するインサイトの作成
クエリの述語に一致するBoxの項目について集計指標を計算します。まずフィルタが適用され、次にグループ化 (省略可) が行われます。その後、作成されたグループごとに、またはフィルタ処理されたデータセット全体に対して、リクエストされた指標 (sum、avg、min、max、countなど) が計算されます。
POST
/
query_insights
Python
client.query.create_query_insight_v2026_r0(
CreateQueryInsightV2026R0Query(
predicate=predicate,
params={"minAmount": 0},
ancestors=[QueryAncestorReferenceV2026R0(id="0", type="folder")],
group_by=[
QueryInsightsGroupByV2026R0(
field="".join([md_prefix, ".category"]), bucket_limit=5
)
],
),
metrics,
)await client.query.createQueryInsightV2026R0({
query: {
predicate: predicate,
params: { ['minAmount']: 0 },
ancestors: [
{ id: '0', type: 'folder' } satisfies QueryAncestorReferenceV2026R0,
],
groupBy: [
{
field: ''.concat(mdPrefix, '.category') as string,
bucketLimit: 5,
} satisfies QueryInsightsGroupByV2026R0,
],
} satisfies QueryInsightsRequestBodyV2026R0QueryField,
metrics: metrics,
} satisfies QueryInsightsRequestBodyV2026R0);try await client.query.createQueryInsightV2026R0(requestBody: QueryInsightsRequestBodyV2026R0(query: QueryInsightsRequestBodyV2026R0QueryField(predicate: predicate, params: ["minAmount": 0], ancestors: [QueryAncestorReferenceV2026R0(id: "0", type: "folder")], groupBy: [QueryInsightsGroupByV2026R0(field: "\(mdPrefix)\(".category")", bucketLimit: 5)]), metrics: metrics))client.getQuery().createQueryInsightV2026R0(new QueryInsightsRequestBodyV2026R0(new QueryInsightsRequestBodyV2026R0QueryField.Builder(predicate).params(mapOf(entryOf("minAmount", 0))).ancestors(Arrays.asList(new QueryAncestorReferenceV2026R0("0", "folder"))).groupBy(Arrays.asList(new QueryInsightsGroupByV2026R0.Builder(String.join("", mdPrefix, ".category")).bucketLimit(5).build())).build(), metrics))await client.Query.CreateQueryInsightV2026R0Async(requestBody: new QueryInsightsRequestBodyV2026R0(query: new QueryInsightsRequestBodyV2026R0QueryField(predicate: predicate) { Parameters = new Dictionary<string, object>() { { "minAmount", 0 } }, Ancestors = Array.AsReadOnly(new [] {new QueryAncestorReferenceV2026R0(id: "0", type: "folder")}), GroupBy = Array.AsReadOnly(new [] {new QueryInsightsGroupByV2026R0(field: string.Concat(mdPrefix, ".category")) { BucketLimit = 5 }}) }, metrics: metrics));{
"insights": [
{
"key": [
"ContractType1"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 180000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 245
}
}
}
},
{
"key": [
"ContractType4"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 100000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 185
}
}
}
},
{
"key": [
"ContractType2"
],
"type": "group",
"metrics": {
"totalContractValue": {
"type": "sum",
"values": {
"sum": 200000
}
},
"countContractType": {
"type": "count",
"values": {
"count": 150
}
}
}
},
{
"key": [],
"type": "other",
"metrics": {
"totalCountBeyondTopGroups": {
"type": "count",
"values": {
"count": 165
}
}
}
}
]
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}{
"type": "error",
"status": 400,
"code": "item_name_invalid",
"message": "Method Not Allowed",
"context_info": {
"message": "Something went wrong"
},
"help_url": "https://developer.box.com/guides/api-calls/permissions-and-errors/common-errors/",
"request_id": "abcdef123456"
}「Box SDKのバージョニング戦略について詳しく学ぶ。」
承認
The access token received from the authorization server in the OAuth 2.0 flow.
ヘッダー
Version header.
利用可能なオプション:
2026.0 ボディ
application/json
インサイト計算のフィルタ、グループ化、指標を記述するリクエスト本文。
フィルタとグループ化の定義。まずフィルタが適用され、次にグループ化が行われてから、指標が計算されます。
Show child attributes
Show child attributes
ユーザー定義指標エイリアスの定義へのマップ。最大で10個の指標を定義できます。各エイリアスは、文字、数字、_、-、または.のみが含まれている、最大256文字の空でない一意の文字列である必要があります。また、数字、_、-、.以外で始まっている必要があります。総数のみをリクエストする場合は空にできます。
Show child attributes
Show child attributes
例:
{
"totalContractValue": {
"type": "sum",
"field": "enterprise_12345678:sales:contractValue"
},
"countContractType": {
"type": "count",
"field": "enterprise_12345678:sales:contractType"
}
}
レスポンス
計算されたインサイトエントリが返されます。
インサイトリクエストの計算結果。インサイトエントリのリストとして返されます。
計算されたインサイトエントリのリスト。各エントリは、グループ、データセット全体、または上位の結果に含まれないグループの集合に対応しています。
Show child attributes
Show child attributes
最終更新日 2026年8月19日
このページは役に立ちましたか?
