Retrieve the List of Attachments of a Stock Item

If you are using the REST API to integrate MYOB Acumatica with an external system, this external system can retrieve the attachments of a stock item. For example, in an online store, you may need to display an image of each item that is sold in the store. Images for the items can be stored in MYOB Acumatica as attachments to the Stock Items (IN202500) form. To display an image of a stock item in the online store, you should retrieve the list of images that are attached to the stock item and then export the needed image as described in Retrieve the File Attached to a Stock Item.

Testing of the Request

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:

  1. Deploy a new MYOB Acumatica instance with the T100 dataset. For details on deploying an instance, see To Deploy an MYOB Acumatica Instance in the Installation Guide.
  2. If you use Postman as the client application for testing, in the IntegrationDevelopmentGuide.postman_collection.json collection (which is located in the IntegrationDevelopment\Help folder of the Help-and-Training-Examples repository on GitHub), make sure the collection variables have the proper values.
  3. 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.

Requests

Tip:
In the request examples below, <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 (such as https://my.acumatica.com) if the instance is installed in the root of the website.

You can use the following request example to retrieve the URL of the attachment of the AAMACHINE1 stock item through the REST API.

GET /AAMACHINE1?$select=InventoryID,files&$expand=files HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/23.200.001/StockItem
Accept: application/json
Content-Type: application/json

An example of a response is shown below.

{
    "id": "2acd2eed-1614-e511-9b82-c86000dddf0b",
    "rowNumber": 1,
    "note": {
        "value": ""
    },
    "InventoryID": {
        "value": "AAMACHINE1"
    },
    "custom": {},
    "_links": {
        "self": ...,
        "files:put": ...
    },
    "files": [
        {
            "id": "9be45eb7-f97d-400b-96a5-1c4cf82faa96",
            "filename": "Stock Items (AAMACHINE1)\\T2MCRO.jpg",
            "href": "/<MYOB Acumatica instance name>/entity/Default/
23.200.001/files/9be45eb7-f97d-400b-96a5-1c4cf82faa96"
        }
    ]
}