You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

无过滤器时include=rootcauses参数无法返回数据问题

Autodesk Construction Cloud API 根因分类接口include=rootcauses参数异常问题

涉及接口

GET /issues/v1/projects/{projectId}/issue-root-cause-categories

正常调用情况

直接调用接口可正确返回所有根因分类,代码示例:

import pandas as pd

def fetchRaw(path, params={}):
    url = f"https://developer.api.autodesk.com/construction/{path}"
    headers = {
        "Authorization": f"Bearer {access_token}",
        "Accept": "application/json"
    }
    
    response = requests.get(url, headers=headers, params=params)
    print(f"Status code: {response.status_code}")
    
    try:
        return response.json()
    except Exception:
        print("Couldn't convert the response to JSON.")
        print(response.text[:1000])
        return None

project_id = "<测试过多个项目ID>"
path = f"issues/v1/projects/{project_id}/issue-root-cause-categories"
output = fetchRaw(path)

df = pd.json_normalize(output["results"])
display(df)

include=rootcauses参数单独使用的异常

添加include=rootcauses参数后,返回结果与未添加参数时一致,rootCauses字段未被填充,代码示例:

params = {"include": "rootcauses"}
outputInclude = fetchRaw(path, params=params)

dfInclude = pd.json_normalize(outputInclude["results"])
display(dfInclude)

临时解决方案:添加过滤器参数

若同时添加过滤参数(如filter[updatedAt]),API可正确返回rootCauses字段,代码示例:

params = {
    "include": "rootcauses",
    "filter[updatedAt]": "1900-01-01..9999-12-31"
}

outputInclude = fetchRaw(path, params=params)
dfInclude = pd.json_normalize(outputInclude["results"])
display(dfInclude)

疑问

include=rootcauses参数似乎仅在搭配过滤器时才生效,单独使用无效果。请问是否有其他用户遇到过相同问题?有没有无需添加过滤器即可稳定获取rootCauses字段的解决方案?

内容的提问来源于stack exchange,提问作者Nanno Bekkers

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.11 23:42:35