Dec 11 2021 01:37 PM
Hi there,
In Azure Data Factory I want to get data from a REST API and push it to a Azure Table Storage.
My challenge is I need to make a call to two different API endpoints to get the details of each purchase order.
First I get the header level information from the Purchase List endpoint, no problem doing that.
Sample API endpoint used:
https://private-anon-92de43072c-dearinventory.apiary-mock.com/ExternalApi/v2/purchaseList
Purchase List documentation here:
https://dearinventory.docs.apiary.io/#reference/purchase/purchase-list/get
Then I need to make a call to the Purchase Order endpoint using the ID from the Purchase List to get the detailed purchase order information.
Purchase List [ID] > Purchase Order [TaskID], where ID = TaskID
https://private-anon-92de43072c-dearinventory.apiary-mock.com/ExternalApi/v2/purchase/order?TaskID=TaskID
So my question is, how do I grab the ID from the Purchase List and pass it to the second API endpoint in a for-each within the Purchase Order API URL?
Purchase Order API documentation:
https://dearinventory.docs.apiary.io/#reference/purchase/purchase-order/get
Where does the TaskID get defined and how to use it? Against the Linked Services? The Dataset? Pipeline?
Any help is much appreciated.
Purchase Order sample of what gets returned:
{ "Total": 2, "Page": 1, "PurchaseList": [ { "ID": "60b75408-f432-407d-bc69-66a0df49bc4c", "BlindReceipt": false, "OrderNumber": "PO-00026", "Status": "INVOICED", "OrderDate": "2018-02-22T00:00:00Z", "InvoiceDate": "2018-02-22T00:00:00Z", "Supplier": "Bayside Club", "SupplierID": "807b6bb2-69d5-46dc-8a6b-1bfe73519dca", "InvoiceNumber": "345345", "InvoiceAmount": 15, "PaidAmount": 15, "InvoiceDueDate": "2018-03-24T00:00:00Z", "RequiredBy": null, "BaseCurrency": "USD", "SupplierCurrency": "USD", "CreditNoteNumber": "CR-00026", "OrderStatus": "AUTHORISED", "StockReceivedStatus": "DRAFT", "UnstockStatus": "NOT AVAILABLE", "InvoiceStatus": "PAID", "CreditNoteStatus": "DRAFT", "LastUpdatedDate": "2018-04-19T04:03:06.52Z", "Type": "Simple Purchase", "CombinedInvoiceStatus": "INVOICED", "CombinedPaymentStatus": "PAID", "CombinedReceivingStatus": "NOT RECEIVED", "IsServiceOnly": false, "DropShipTaskID": null }, { "ID": "4e60f55a-1690-4024-a58c-29d62106a645", "BlindReceipt": false, "OrderNumber": "PO-00080", "Status": "COMPLETED", "OrderDate": "2018-04-12T00:00:00Z", "InvoiceDate": "2018-04-10T00:00:00Z", "Supplier": "Bayside Wholesale", "SupplierID": "ca1e53f5-0560-4de6-8956-fac50a32540b", "InvoiceNumber": "INV-00080", "InvoiceAmount": 54.31, "PaidAmount": 0, "InvoiceDueDate": "2018-05-10T00:00:00Z", "RequiredBy": null, "BaseCurrency": "USD", "SupplierCurrency": "USD", "CreditNoteNumber": "CR-00080", "OrderStatus": "AUTHORISED", "StockReceivedStatus": "AUTHORISED", "UnstockStatus": "AUTHORISED", "InvoiceStatus": "PAID", "CreditNoteStatus": "AUTHORISED", "LastUpdatedDate": "2018-04-12T05:36:13.177Z", "Type": "Simple Purchase", "CombinedInvoiceStatus": "INVOICED / CREDITED", "CombinedPaymentStatus": "PAID", "CombinedReceivingStatus": "FULLY RECEIVED", "IsServiceOnly": false, "DropShipTaskID": "31760d16-c2e5-4620-9e09-0b236b776cef" } ] }
Purchase Order sample of what gets returned
https://private-anon-92de43072c-dearinventory.apiary-mock.com/ExternalApi/v2/purchase/order?TaskID=TaskID
Purchase Order sample of what gets returned
https://private-anon-92de43072c-dearinventory.apiary-mock.com/ExternalApi/v2/purchase/order?TaskID=02b08cd2-51d2-41e6-ab97-85bcd13e7136
{ "TaskID": "02b08cd2-51d2-41e6-ab97-85bcd13e7136", "CombineAdditionalCharges": false, "Memo": "", "Status": "AUTHORISED", "Lines": [ { "ProductID": "c08b3876-89cc-46c4-af52-b77f058fdf81", "SKU": "Bread", "Name": "Baked Bread", "Quantity": 2, "Price": 2, "Discount": 0, "Tax": 0, "TaxRule": "Sales Tax on Imports", "SupplierSKU": "", "Comment": "", "Total": 4 }, { "ProductID": "c08b3876-89cc-46c4-af52-b77f058fdf81", "SKU": "Bread", "Name": "Baked Bread", "Quantity": 1, "Price": 2, "Discount": 0, "Tax": 0, "TaxRule": "Sales Tax on Imports", "SupplierSKU": "", "Comment": "", "Total": 2 } ], "AdditionalCharges": [ { "Description": "Half day training - Microsoft Office", "Reference": "", "Price": 3, "Quantity": 1, "Discount": 0, "Tax": 0, "Total": 3, "TaxRule": "Sales Tax on Imports" } ], "TotalBeforeTax": 9, "Tax": 0, "Total": 9 }