This topic will demonstrate how to export records from Acumatica ERP via the REST Contract-Based API. In contrast to the Screen-Based API of Acumatica ERP, the Contract-Based API provides both SOAP and REST interfaces. For more information on the Contract-Based API, see Acumatica ERP Documentation
相关问题
- Design RESTful service with multiple ids
- Axios OPTIONS instead of POST Request. Express Res
- Plain (non-HTML) error pages in REST api
- Laravel 5.1 MethodNotAllowedHttpException on store
- Can I parameterize labels and properties on CREATE
相关文章
- Got ActiveRecord::AssociationTypeMismatch on model
- Multiple parameters in AngularJS $resource GET
- Global Exception Handling in Jersey & Spring?
- REST search interface and the idempotency of GET
- Getting error detail from WCF REST
- Send a GET request with a body in JavaScript (XMLH
- GuzzleHttp Hangs When Using Localhost
- JAX-RS (Jersey) ExceptionMapper - @Context injecti
Data Export in a Single REST Call
In this example you will explore how to export the following data from Acumatica ERP in a single call via the REST Contract-Based API:
If you need to export records from Acumatica ERP, use the following URL:
http://<Acumatica ERP instance URL>/entity/<Endpoint name>/<Endpoint version>/<Top-level entity>
<Top-level entity>
is the name of the entity which you are going to exportTo export all stock items in a single REST call:
To export stock item records from a local
AcumaticaERP
instance by using the Default endpoint of version 6.00.001, you should use the following URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem
Below is the sample code written in C# to export all stock items by sending a single REST call to the Default endpoint of version 6.00.001:
To export all sales order of the IN type in a single REST call:
To export sales orders of the IN type from a local
AcumaticaERP
instance by using the Default endpoint of version 6.00.001, you should use the following URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/SalesOrder?$filter=OrderType eq 'IN'
Below is the sample code written in C# to export all sales orders of the IN type by sending a single REST call to the Default endpoint of version 6.00.001:
Pagination with Multiple REST Requests
In this example you will explore how to export the following data from Acumatica ERP in batches via the REST Contract-Based API:
To export stock items in batches of 10 records with multiple REST calls:
To export first 10 stock items from a local
AcumaticaERP
instance by using the Default endpoint of version 6.00.001, you should use the following URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem?$top=10
Accordingly, to request stock items from 10 to 20, you simply extend the URL above with filter parameter:
http://localhost/AcumaticaERP/entity/Default/6.00.001/StockItem?$top=10&$filter=InventoryID gt '<InventoryID>'
<InventoryID>
is the ID of the last stock item exported with a previous REST callBelow is the sample code written in C# to export all stock items in batches of 10 records by sending multiple REST calls to the Default endpoint of version 6.00.001:
To export all sales orders in batches of 100 records with multiple REST calls: ##
To export first 100 sales orders from a local
AcumaticaERP
instance by using the Default endpoint of version 6.00.001, you should use the following URL:http://localhost/AcumaticaERP/entity/Default/6.00.001/SalesOrder?$top=100
Since the primary key of the Sales Order entity is composed by the Order Type and the Order Number, in this example you will be using a combination of filter parameters for the Order Type and Order Number fields:
http://localhost/AcumaticaERP/entity/Default/6.00.001/SalesOrder?$top=100&$filter=OrderType eq 'SO' and OrderNbr gt '<OrderNbr>'
<OrderNbr>
is the number of the last sales order exported with a previous REST callhttp://localhost/AcumaticaERP/entity/Default/6.00.001/SalesOrder?$top=100&$filter=OrderType gt 'SO' and OrderNbr gt ''
Below is the sample code written in C# to export all sales orders in batches of 100 records with multiple REST calls to the Default endpoint of version 6.00.001:
To communicate with the REST Contract-Based API of Acumatica ERP your client application must always perform the following 3 steps:
All samples provided in this topic were built with the Default endpoint, always deployed as part of the standard Acumatica ERP installation process. On the Web Service Endpoints screen (SM.20.70.60) you can view the details of existing endpoints or configure your custom endpoints of the Acumatica ERP contract-based web services:
For your reference, below is implementation of the RestService class used in all samples above to interact with the Contract-Based web service of Acumatica ERP: