Using Postman report is returned with headers but no data

Options
Star
Star Expensify Customer Posts: 2

I'm using postman to test an integration. I'm trying to run a report and download it.

The report runs fine and I can download it but the file I receive only has headers and no actual data in it.

In my report exporter call, my requestJobDescription is:

{

"type":"file",

"credentials":{

"partnerUserID":"_REMOVED_",

"partnerUserSecret":"_REMOVED_"

},

"onReceive":{

"immediateResponse":["returnRandomFileName"]

},

"inputSettings":{

"type":"combinedReportData",

"reportState":"APPROVED,REIMBURSED,ARCHIVED",

"limit":"100",

"filters":{

"startDate":"2019-01-01",

"endDate":"2019-06-30"

}

},

"outputSettings":{

"fileExtension":"csv",

"fileBasename":"myExport"

},

"onFinish":[

{"actionName":"email","recipients":"_REMOVED_", "message":"Report is ready."}

]

}


And I'm passing the template as a second parameter with:

<#if addHeader == true>

Merchant,Original Amount,Category,Report number,Expense number<#lt>

</#if>

<#assign reportNumber = 1>

<#assign expenseNumber = 1>

<#list reports as report>

<#list report.transactionList as expense>

${expense.merchant},<#t>

<#-- note: expense.amount prints the original amount only -->

${expense.amount},<#t>

${expense.category},<#t>

${reportNumber},<#t>

${expenseNumber}<#lt>

<#assign expenseNumber = expenseNumber + 1>

</#list>

<#assign reportNumber = reportNumber + 1>

</#list>


I can mentions of postman on here and mentions of blank/empty reports but no specific solutions to this.

thanks

Answers

  • Francois Laithier
    Francois Laithier Expensify Team Posts: 33 Expensify Team
    Options

    Hi there,

    If the report you download contains the headers of the template but no expense data, it means that your request is correct, but the account you're using doesn't have any expenses data for the filters you specified.

    Specifically, because of the filters:

    "reportState":"APPROVED,REIMBURSED,ARCHIVED",
    "startDate":"2019-01-01",
    "endDate":"2019-06-30"
    

    your account will need to have any Approved, Reimbursed or Closed reports that were submitted within 2019-01-01 and 2019-06-30.

    As a first step, I'd suggest removing the reportState and endDate filters entirely, to see if you get any data, and then tune the filters to only keep the expenses you need.

    Also, log into the Expensify account the partnerUserID/partnerUserSecret credentials were generated for, and use the same filters on the Reports page to check if you see any reports.

  • Star
    Star Expensify Customer Posts: 2
    Options

    I'm trying to get expenses for ALL accounts not just the account used for authentication.

    The account I'm using is just a service account and so doesn't have expenses, so what you're saying appears correct. However how do I select other accounts?

    I can see in the documentation an employeeemail field within the input settings but it appears singular. Does that mean I would have to run the report individually for every employee? or can that be a comma separated list?

  • Francois Laithier
    Francois Laithier Expensify Team Posts: 33 Expensify Team
    Options

    The employeeEmail parameter requires configuration for additional permissions, so it won't work out of the box, and I wouldn't recommend using it.

    Rather, the easiest would be to use the credentials of an account that has access to the reports you're trying to export. Basically, if you can see a report on the Reports page, you can export it via the API. If you can't see a report, you can't export it via the API.

    If you go to Settings > Policies > Group in the web app, you'll see the owner of each policy you're a member of. Policy owners and administrators can access all reports under that policy, so you'd be able to export the reports via the API if you used credentials from such an account.