如何使用 C# REST Web 服务从记录中获取附件
How can I obtain an attached file from a record using the C# REST web services
我正在尝试从 Acumatica 中的记录中检索一个(或多个)附加文件。我正在使用以下示例:
https://help-2021r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=b1bc82ee-ae6b-442a-a369-863d98f14630
我已将文件附加到演示库存商品“AACOMPUT01”。
大部分代码按预期运行,但是当它到达代码行时:
JArray jFiles = jItem.Value<JArray>("files");
它 returns 对于 jFiles JArray 为 null - 就好像没有附加文件一样。
这个例子有什么问题吗?或者我需要添加什么才能让它工作?
我使用的是 2021 R1 (21.107.0023),端点默认为 20.200.001...
谢谢...
使用 expand files
选项在 StockItem
端点上执行 GET 请求:
http:///localhost/Acumatica/entity/Default/20.200.001/StockItem/AACOMPUT01?$expand=files
此 returns 文件数组:
"files": [
{
"id": "bdb9534c-6aa9-41fa-a65d-3119e32b0fe5",
"filename": "Stock Items (AACOMPUT01)\AACOMPUT01.jpg",
"href": "/Acumatica/entity/Default/20.200.001/files/bdb9534c-6aa9-41fa-a65d-3119e32b0fe5"
}
使用href
URL参数值发出GET请求,returns文件内容:
http:///localhost/Acumatica/entity/Default/20.200.001/files/bdb9534c-6aa9-41fa-a65d-3119e32b0fe5
我正在尝试从 Acumatica 中的记录中检索一个(或多个)附加文件。我正在使用以下示例:
https://help-2021r1.acumatica.com/Help?ScreenId=ShowWiki&pageid=b1bc82ee-ae6b-442a-a369-863d98f14630
我已将文件附加到演示库存商品“AACOMPUT01”。
大部分代码按预期运行,但是当它到达代码行时:
JArray jFiles = jItem.Value<JArray>("files");
它 returns 对于 jFiles JArray 为 null - 就好像没有附加文件一样。 这个例子有什么问题吗?或者我需要添加什么才能让它工作?
我使用的是 2021 R1 (21.107.0023),端点默认为 20.200.001...
谢谢...
使用 expand files
选项在 StockItem
端点上执行 GET 请求:
http:///localhost/Acumatica/entity/Default/20.200.001/StockItem/AACOMPUT01?$expand=files
此 returns 文件数组:
"files": [
{
"id": "bdb9534c-6aa9-41fa-a65d-3119e32b0fe5",
"filename": "Stock Items (AACOMPUT01)\AACOMPUT01.jpg",
"href": "/Acumatica/entity/Default/20.200.001/files/bdb9534c-6aa9-41fa-a65d-3119e32b0fe5"
}
使用href
URL参数值发出GET请求,returns文件内容:
http:///localhost/Acumatica/entity/Default/20.200.001/files/bdb9534c-6aa9-41fa-a65d-3119e32b0fe5