單個 REST 呼叫中的資料匯出
在本例中,你將探索如何通過基於 REST 契約的 API 在一次呼叫中從 Acumatica ERP 匯出以下資料:
- 應用程式中存在的所有庫存專案
- IN 型別的所有銷售訂單
如果你需要從 Acumatica ERP 匯出記錄,請使用以下 URL:http://<Acumatica ERP instance URL>/entity/<Endpoint name>/<Endpoint version>/<Top-level entity>
<Top-level entity>
是你要匯出的實體的名稱
要在單個 REST 呼叫中匯出所有庫存專案:
要使用版本 6.00.001 的預設端點從本地 AcumaticaERP
例項匯出庫存專案記錄,你應使用以下 URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem
******
下面是用 C#編寫的示例程式碼,用於通過向版本 6.00.001 的預設端點傳送單個 REST 呼叫來匯出所有庫存項 : ******
using (RestService rs = new RestService(
@"http://localhost/AcumaticaERP/", "Default/6.00.001",
username, password, company, branch))
{
string stockItems = rs.GetList("StockItem");
}
要在單個 REST 呼叫中匯出 IN 型別的所有銷售訂單:
要使用版本 6.00.001 的預設端點從本地 AcumaticaERP
例項匯出 IN 型別的銷售訂單,你應使用以下 URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/SalesOrder?$filter=OrderType eq 'IN'
****** ******
下面是用 C#編寫的示例程式碼,通過向版本 6.00.001 的預設端點傳送單個 REST 呼叫來匯出 IN 型別的所有銷售訂單 : ****** ******
using (RestService rs = new RestService(
@"http://localhost/StackOverflow/", "Default/6.00.001",
username, password, company, branch))
{
var parameters = "$filter=OrderType eq 'IN'";
string inSalesOrders = rs.GetList("SalesOrder", parameters);
}