通过Forma API获取Relationship时sheetlineage ID与Sheet ID不匹配的解决咨询
问题场景:通过Forma API获取Submittal与Sheet的Relationship时,返回的sheetlineage实体ID无法匹配Sheet API返回的任何Sheet ID:
{ "id": "74b70bb8-8802-a1fd-f201-890375a60c8f", "createdOn": "2015-10-21T16:32:22Z", "isReadOnly": true, "isService": false, "isDeleted": false, "entities": [ { "domain": "autodesk-construction-sheet", "type": "sheetlineage", "id": "2b95ba7a-3df5-4e99-a693-9c7cc15ee8c0", "createdOn": "2021-07-29T11:39:12+01:00" }, { "domain": "autodesk-construction-submittals", "type": "submittalitem", "id": "urn:adsk.wipprod:dm.lineage:hC6k4hndRWaeIVhIjvHu8w", "createdOn": "2021-07-29T13:39:12+01:00" } ] }
可行解决办法
调用Sheet Lineage API转换ID
sheetlineage实体用于追踪图纸的版本谱系,直接使用该ID调用GET /construction/sheetlineages/{sheetLineageId}接口,返回结果中会包含关联的原始Sheet ID,该ID可直接与Sheet API返回的Sheet资源ID匹配。在Sheet API请求中包含版本参数
Sheet API默认可能仅返回最新版本的图纸,若sheetlineage关联的是历史版本,可在请求中添加includeVersions=true参数,获取所有版本的Sheet记录,从中匹配对应的ID。通过Submittal Item反向查询Sheet信息
利用Relationship中的submittalitem ID,调用GET /construction/submittals/{submittalId}/items/{submittalItemId}接口获取提交项详情,返回结果的sheet字段会直接提供可匹配Sheet API的ID,无需通过谱系转换。验证API权限与项目上下文
确保调用Sheet API和Forma API时使用相同的项目ID参数,且权限范围包含data:read(针对sheets和sheetlineages资源),避免因跨项目或权限不足导致的资源不匹配。
内容的提问来源于stack exchange,提问作者manjiro sano

