简体   繁体   English

Azure 数据工厂 - 复制活动 - 休息 api 集合参考

[英]Azure Data Factory - Copy Activity - rest api collection reference

Helo eveyone,大家好,

I am fairly new to Data Factory and I need to copy information from Dynamics Business Central's Rest API.我是数据工厂的新手,我需要从 Dynamics Business Central 的 Rest API 复制信息。 I am struggling with the "Details" type entities such as "invoiceSalesHeader".我正在努力处理“详细信息”类型的实体,例如“invoiceSalesHeader”。

The api for that entity forces me to provide a header ID as a filter.该实体的 api 强制我提供标题 ID 作为过滤器。 In that sense, I would have to loop x times (a few thousand) and call the Rest API to retreive the lines of each sales invoice.从这个意义上说,我必须循环 x 次(几千次)并调用 Rest API 来检索每张销售发票的行。 I find that completely ridiculous and am trying to find other ways to get the information.我觉得这完全是荒谬的,我正在努力寻找其他方式来获取信息。

To avoid doing that, I am trying to get the information by calling the "salesInvoice" entity and use "$expand=salesInvoiceLines".为了避免这样做,我试图通过调用“salesInvoice”实体并使用“$expand=salesInvoiceLines”来获取信息。

That gets me the information I need but inside data factory's Copy Activity, I am struggling with what I should put as a "collection reference" so that I end up with one row per salesInvoiceLine.这为我提供了我需要的信息,但在数据工厂的复制活动中,我正在努力解决我应该将其作为“集合参考”的内容,以便每个 salesInvoiceLine 最终得到一行。

The data returned is an array of sales invoices with a sub array of invoice lines.返回的数据是带有发票行子数组的销售发票数组。

If I select "salesInvoiceLines" as the collection reference, I end up with "$['value'][0]['salesInvoiceLines']" and that only gives me the lines for the first invoice (since there is an index of zero).如果我选择“salesInvoiceLines”作为集合参考,我最终会得到“$['value'][0]['salesInvoiceLines']”并且只给我第一张发票的行(因为索引为零)。

What should I put in Collection Reference so that I get one row per salesInvoiceLine我应该在 Collection Reference 中放入什么,以便每个 salesInvoiceLine 获得一行

在此处输入图片说明

It is not support to foreach nested json array in ADF.不支持在 ADF 中 foreach 嵌套的 json 数组。
Alternatively, we can use a Flattern activity in data flow to flatten the nested json array.或者,我们可以在数据流中使用 Flattern 活动来展平嵌套的 json 数组。

Here is my example:这是我的例子:
This is my example json data, the structure is like yours:这是我的示例 json 数据,结构与您的类似:

[
 {
 "id": 1,
 "Value": "January",
 "orders":[{"orderid":1,"orderno":"qaz"},{"orderid":2,"orderno":"edc"}]
 },
 {
 "id": 2,
 "Value": "February",
 "orders":[{"orderid":3,"orderno":"wsx"},{"orderid":4,"orderno":"rfv"}]
 },
 {
 "id": 3,
 "Value": "March",
 "orders":[{"orderid":5,"orderno":"rfv"},{"orderid":6,"orderno":"tgb"}]
 },
 {
 "id": 11,
 "Value": "November",
 "orders":[{"orderid":7,"orderno":"yhn"},{"orderid":8,"orderno":"ujm"}]
 }
]

In the dataflow, we can select the header of the nested json array, here is orders :在数据流中,我们可以选择嵌套 json 数组的头部,这里是orders 在此处输入图片说明

Then we can see the result, we have transposed the JSON orders array with 2 objects (orderid, orderno) into 8 flatten rows:然后我们可以看到结果,我们已经将包含 2 个对象(orderid、orderno)的 JSON orders数组转置为 8 个扁平行: 在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 REST 上设置分页 API 在 azure 数据工厂中复制源为 shopify - Setting Pagination on REST API copy source in azure data factory for shopify 如何使用Data Factory v2将数据从REST API终结点复制到Azure DB? - How do I copy data from REST API endpoint into Azure DB using Data Factory v2? 从 API 管理计划数据工厂复制活动的刷新令牌 - Managing Refresh Tokens for Scheduled Data Factory Copy Activity from API 使用 Azure 数据工厂从 REST API 获取数据 - Using Azure Data Factory to get data from a REST API 使用 Azure 数据工厂从 REST API 引入传入数据 - Using Azure Data Factory to ingest incoming data from a REST API 使用 Azure 数据工厂从 REST API 读取 JSON - Read JSON from rest API as is with Azure Data Factory 如何在 Azure 数据工厂中使用这个 Rest API - How can I consume this Rest API in Azure Data Factory 如何使用 Azure 数据工厂管道调用 REST API? - How to call a REST API using Azure Data Factory Pipelines? Azure 数据工厂 - REST 到 Azure Z9778840A0100CB30C9828 带过滤器7B27B767 - Azure Data Factory - REST to Azure SQL with filter 我正在尝试通过 azure 数据工厂将数据从 REST API 下载到 azure 数据湖。 如何在 azure 数据工厂中传递 API 的查询参数? - I am trying to download data from REST API to azure data lake via azure data factory. How can I pass query parameters for API in azure data factory?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM