Get an Attachment Associated with an Expense Report

GET /expense-reports​/{id}​/attachments/{attachment_id} — Use this method to retrieve the attachment record with the specified attachment ID associated with the expense report with the specified internal ID. The response contains the attachment metadata only and not the file.

Parameters

Path parameters

Path parameter

Required / Optional

Description

Type

{id}

Required

The internal ID of the expense report.

integer

{attachment_id}

Required

The internal ID of the attachment.

integer

Query string parameter

Path parameter

Required / Optional

Description

Type

expand

Optional

A comma-separated list of attributes available for expansion. The comma-separated list may include spaces (or %20 in the URL encoded string).

string

fields

Optional

A comma-separated list of attributes to include in the response. If not specified, the response includes all attributes for the attachment metadata returned.

string

filterSetId

Optional

The internal ID of the filter set to be applied.

  • When specified, the response includes only data that is available when the specified filter set is active in OpenAir. The filter set with the specified internal ID must exist and must be associated with the user who authorized the application as per the access token.

  • Otherwise and by default, the primary filter set associated with the user who authorized the application is applied.

integer

Response definitions

A successful request returns a JSON object with the following properties:

Property

Description

data

An array containing the attachment metadata requested. See Returned Data.

included

An array of expanded objects, if the expand parameter was set in the request.

See Referenced Objects and Expansion.

meta

An object containing information about objects referenced by internal ID in the data array (object type and internal ID).

See Referenced Objects and Expansion.

message

A string containing a brief message about the status of your request — for example, “Success”.

A failed request returns a JSON object with the following properties:

Property

Description

message

A string containing a brief message about the status of your request — for example, “Attachment #598 not found”.

Sample request

            GET expense-reports​/237/attachments/4982?fields=fileName,isLocked,uploadedBy,size,id,fileType HTTP/1.1
Host: company-id.app.openair.com
Authorization: Bearer <OAuth2_access_token> 

          

In the example, <OAuth2_access_token> is the OAuth 2.0 access token obtained for the client application connecting to OpenAir. See Authentication.

Sample response

            {
   "data": [
      {
            "fileName": "2020-11-20_13-25-06.png",
            "isLocked": false,
            "id": 4982,
            "uploadedBy": 49,
            "fileType": "PNG image data, 1250 x 800, 8-bit/color RGBA, non-interlaced",
            "size": 114659
      }
   ],
   "message": "success",
   "meta": {
       "relationships": [
               {
                  "uploadedBy": {
                      "data": { "type": "userDisplayName", "id": 49 }
                  }
             }
          ]
   }
}