沙箱环境下Salesforce Flow HTTP调用无法访问嵌套数组
Salesforce流HTTP调用Beta版无法访问嵌套数组响应的问题
问题背景
在Salesforce沙箱环境中,通过流的HTTP调用Beta功能对接Nasdaq国债收益率数据接口,该功能会根据接口返回的示例响应自动生成外部服务定义。
核心问题
接口返回的JSON中,data字段为嵌套数组结构,示例如下:
"data":[["2023-02-02","4.62","4.65","4.66","4.76","4.64","4.09","3.75","3.49","3.44","3.4","3.67","3.55"]]
在流中访问响应时,column_names数组可以正常读取,但data数组完全无法被访问。
自动生成的OpenAPI定义
系统生成的OpenAPI JSON如下:
{"openapi":"3.0.1", "info":{"title":"dataNasdaqGetRates" ,"description":""}, "paths":{"":{"get":{"description":"", "operationId":"getRates", "parameters":[{"name":"api_key","in":"query","required":true,"allowEmptyValue":false, "schema":{"type":"string"}}, {"name":"order","in":"query","required":true,"allowEmptyValue":false, "schema":{"type":"string"}}, {"name":"limit","in":"query","required":true,"allowEmptyValue":false, "schema":{"type":"integer","format":"int32"}}], "responses":{"2XX":{"description":"", "content":{"application/json":{"schema":{"type":"object", "properties":{"dataset":{"type":"object", "properties":{"end_date":{"type":"string"}, "data":{"type":"array", "items":{"type":"array", "items":{"type":"string"}}}, "description":{"type":"string"}, "newest_available_date":{"type":"string"}, "type":{"type":"string"}, "dataset_code":{"type":"string"}, "column_index":{"type":"string"}, "frequency":{"type":"string"}, "oldest_available_date":{"type":"string"}, "transform":{"type":"string"}, "premium":{"type":"boolean"}, "refreshed_at":{"type":"string"}, "database_id":{"type":"integer", "format":"int64"}, "database_code":{"type":"string"}, "name":{"type":"string"}, "limit":{"type":"integer","format":"int64"}, "id":{"type":"integer","format":"int64"}, "column_names":{"type":"array", "items":{"type":"string"}}, "collapse":{"type":"string"}, "start_date":{"type":"string"}, "order":{"type":"string"} }}}}}}}}}}}}
已尝试的解决方法
- 修改OpenAPI JSON,移除
data字段的嵌套数组定义 - 为
data的嵌套数组添加多类型定义(实际子元素第一个是日期字符串,其余为数值字符串)
以上操作均未解决data数组无法访问的问题。
期望结果
希望在流的响应项菜单中,column_names之后能显示名为data的Apex定义列表,或者任何可存入变量并正常访问的data相关内容。
流中响应项菜单翻译
原英文菜单翻译为中文如下:
- 数据集(Dataset)
- 结束日期(End Date)
- 描述(Description)
- 最新可用日期(Newest Available Date)
- 类型(Type)
- 数据集代码(Dataset Code)
- 列索引(Column Index)
- 频率(Frequency)
- 最早可用日期(Oldest Available Date)
- 转换(Transform)
- 付费标识(Premium)
- 刷新时间(Refreshed At)
- 数据库ID(Database ID)
- 数据库代码(Database Code)
- 名称(Name)
- 限制条数(Limit)
- ID(ID)
- 列名称(Column Names)
- 合并方式(Collapse)
- 开始日期(Start Date)
- 排序方式(Order)
内容的提问来源于stack exchange,提问作者Kashona
相关产品推荐
相关产品推荐

