Retrieve the List of Customers with Contacts
If you are using the contract-based REST API to integrate MYOB Acumatica with an external system, this external system can retrieve the list of customers with contacts.
You will use the GET
HTTP method and the Customer
entity of the Default/24.200.001 endpoint to list the customer records. The Customer
entity is mapped to the Customers (AR303000)
form.
System Preparation
Before you test the code below, you need to do the following to configure your client application and the MYOB Acumatica instance to be used:- Deploy a new MYOB Acumatica instance with the T100 dataset. For details on deploying an instance, see Instance Deployment: To Deploy an Instance with Demo Data in the Installation Guide.
- If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection, make sure that the collection’s variables have the proper values. This collection is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub.
- To sign in to the instance in the client application, use the tenant name (which you specified when you created the instance) and the MYSTORE branch.
Request
You can use the following sample request to retrieve the list of contacts through the contract-based REST API. For each contact, the main contact, including the address, is retrieved.
<MYOB Acumatica instance URL>
is the URL of the MYOB Acumatica
instance (such as https://my.acumatica.com/MyInstance). You can omit the instance
name in the URL (that is, you can use https://my.acumatica.com) if the instance
is installed in the root of the website.GET /entity/Default/24.200.001/Customer?
$expand=MainContact,MainContact/Address&
$select=CustomerID,CustomerName,CustomerClass,MainContact/Email,
MainContact/Phone1,MainContact/Address/AddressLine1,
MainContact/Address/AddressLine2,MainContact/Address/City,
MainContact/Address/State,MainContact/Address/PostalCode HTTP/1.1
Host: [<MYOB Acumatica instance URL>]
Accept: application/json
Usage Notes
The database can contain thousands of customer records, and each record includes dozens of fields. Thus, to achieve the best performance of the integration application during the export of records, you need to specify the fields of the customer records that should be returned. You use the $select parameter to specify the fields whose values should be retrieved from MYOB Acumatica for each customer record.
You use the $expand parameter to specify the nested entities to be returned. In this parameter, you have to specify all the nested entities whose fields you need to retrieve from MYOB Acumatica.