Retrieve Comments for Attached Files

You can retrieve comments that have been specified for the files attached to a record from MYOB Acumatica by using the contract-based REST API. To do this, you access the needed URL with the GET HTTP method and specify the files array to be returned. See the following sections for details on the request and the response.

HTTP Method and URL

To retrieve a record with the list of files attached to the record and comments specified for these files, you use the GET HTTP method and the same URL as you would use to retrieve a record (see Retrieve a Record by Key Fields and Retrieve a Record by ID).

Parameters

A comment for a file is returned in the comment field for the file item in the files array. To retrieve a record with comments for the files attached to the record, you use the $expand and $select parameters with files as the value. For detailed descriptions of the parameters, see Parameters for Retrieving Records.

You can also use other parameters that are available for a request to retrieve a record. For details, see Retrieve a Record by Key Fields and Retrieve a Record by ID.

Request Headers

You specify the following header in the request.

HeaderDescription
Accept

Specifies the format of the response body, which should be application/json.

Response Status Codes

The following table lists the HTTP status codes that the system returns for a request that retrieves a record.

CodeDescription
200The request has been completed successfully. The response body contains the requested record.
401

The user is not signed in to the system.

403

The user has insufficient rights to access the MYOB Acumatica form that corresponds to the API entity.

429

The number of requests has exceeded the limit imposed by the license (see License Restrictions for API Users).

500

An internal server error has occurred.

Example

The following example request retrieves the list of files attached to the EJECTOR03 stock item.

Tip:
In the request example 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 (that is, you can use https://my.acumatica.com) if the instance is installed in the root of the website.
GET /EJECTOR03?$select=InventoryID,files&$expand=files HTTP/1.1
Host: [<MYOB Acumatica instance URL>]/entity/Default/24.200.001/StockItem
Accept: application/json
Content-Type: application/json

The response body, shown below, includes the comment in the comment field.

{
  "id":"a0f8594a-7de2-e811-b816-00155d408001",
  "rowNumber":1,
  "note":
  {
    "value":""
  },
  "InventoryID":
  {
    "value":"EJECTOR03"
  },
  "custom":{},
  "_links":
  {
    "self":"...",
    "files:put":"..."
  },
  "files":
  [
    {
      "id":"8050623c-b31f-42a1-876a-13598c90fd29",
      "filename":"Stock Items (EJECTOR03   )\\T2MCRO.jpg",
      "href":"...",
      "comment":"Test comment"
    }
  ]
}