Attachments Lookup by Report ID
This guide outlines the sequence and essential API calls needed to retrieve all attachments for a given expense report. Before starting, ensure that your API user is properly configured with the necessary permissions, as access will be denied otherwise.
Step 1: Retrieve Attachments for a Report
Method: getXpAttachmentList
getXpAttachmentList
The getXpAttachmentList
API call retrieves a list of all attachments associated with a given expense report. This includes both attachments linked directly to expense lines and those attached at the report level.
Request Header:
{
"Content-Type": "application/json",
"api-key": "your_api_key"
}
Parameters:
Provide the reportId
to retrieve all related attachments:
{
"reportId": "your_report_id"
}
Response Structure:
The response will include a list of attachments with key details such as file names, attachment locations, and expense line numbers.
Example Response:
{
"success": true,
"result": [
{
"attachmentId": 1,
"ccTransNo": 0,
"descr": "Airfare",
"dtstamp": "2018-06-08T08:44:32.533-0500",
"eLineNo": 2,
"enteredBy": "EMPLYID",
"fileLocation": "2023198643129342",
"fileName": "2023198643129342.jpeg",
"fileType": "jpeg",
"reportId": 12934,
"sortOrder": 1,
"mediaFsId": "attachments",
"mediaName": "2023198643129342/2023198643129342.jpeg",
"mediaType": "jpeg",
"imageOriginal": "",
"image": "attach:attachments:2023198643129342/2023198643129342.jpeg"
}
],
"amount": 1
}
Understanding the Response Data
-
eLineNo
: The expense line number the attachment is linked to.- If
eLineNo
is 0, the attachment is either:- A. Attached at the report level.
- B. Part of an itemized charge. To determine if it belongs to an itemized charge, check
ccTransNo
:- If
ccTransNo
is not 0, then the attachment should be linked to all expense lines matching thisccTransNo
.
- If
- If
-
fileName
&mediaName
: Used to identify and download the attachment. -
dtstamp
: Timestamp indicating when the attachment was uploaded. -
descr
: Description of the attachment.
Next Steps
Once you retrieve the attachment list, you can proceed to download each file using the attachment
API method. Use the mediaFsId
and mediaName
values from the response to construct the necessary request for downloading attachments.
Updated about 1 month ago