API report list based on user email

Options
jeff_klick
jeff_klick Expensify Customer Posts: 6 Expensify Newcomer
edited April 2020 in Integrations and API

Hi there,
I am calling expensify Report Export api service with the the company account's credential. Instead of fetching all the transactions in the exported report, i only need to get the list based on a given user email address. However i am getting error message "Not authorized to authenticate as user". Any help?

Answers

  • Ted Harris
    Ted Harris Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 359 Expensify Team
    Options

    Hi @jeff_klick, thanks for posting in the Expensify Community! It's so great to have more people asking and answering API questions in here. :smiley:

    Without seeing the specific query, it's difficult to determine exactly where this is going wrong. However, it's likely a misconfiguration of the employeeEmail string in the inputSettings. For reference, you cannot determine individual's employees to export, you can only specify the Status (ie: APPROVED, REIMBURSED etc) and the inputSettings.filters.

    The employeeEmail field is simply used to configure which user we determine to have performed the Report Export, rather than the user who's reports are the subject of the export.

  • jeff_klick
    jeff_klick Expensify Customer Posts: 6 Expensify Newcomer
    Options

    Thanks for the rely @Ted_Peeters
    This is the requestJobDescription I am using in C#.

    type = "file",
    credentials = new
    {
    partnerUserID = {myUserID},
    partnerUserSecret = {myUserSecret}
    },
    onReceive = new
    {
    immediateResponse = new[] { "returnRandomFileName" }
    },
    inputSettings = new
    {
    type = "combinedReportData",
    reportState = "ARCHIVED",
    employeeEmail = {targetUserEmail},
    filters = new
    {
    startDate = lastRun.ToString("yyyy-MM-dd"),
    markedAsExported = importedTag
    }
    },
    outputSettings = new
    {
    fileExtension = "json"
    },
    test = true,
    onFinish = new[] {
    new {
    actionName = "markAsExported",
    label = importedTag
    }
    }

    The reason I want to export the report by a single user email is to speed up the request and let each user to sync their expensify items in our platform. Where should i put the filter employeeEmail in the request?

  • Ted Harris
    Ted Harris Expensify Success Coach - Admin, Expensify Team, Expensify Student Ambassador Posts: 359 Expensify Team
    Options

    Hiya @jeff_klick, apologies if I wasn't clear enough!

    The employeeEmail string is listed in inputSettings but it is not a filter. You'll note it's not listed with the remainder of the inputSettings.filters here.

    You cannot use the Report Exporter API to filter on an individual's reports. This will have to be done outside of the Report Exporter API, most often as a manual spreadsheet filter.

    When we state in the Description column that:

    The reports will be exported from that account.

    This means we use the owner of the account listed for employeeEmail to audit who performed the export. The export is exported from that account rather than The export contains only reports from that account.

    If you'd like to make use of this field, you'll need to follow the steps here to reach out for verification you can act on behalf of others on your Domain/Policy.

  • jeff_klick
    jeff_klick Expensify Customer Posts: 6 Expensify Newcomer
    Options

    I took a look at the notes in https://community.expensify.com/discussion/comment/4596/#Comment_4596

    1. Make sure you're set up correctly, (using Domain Control, are a Domain Admin, are a Policy Admin etc...)
    2. Validate you are authorized internally to add data to other accounts on your domain.

    Pretty sure i did the 1st part. Not quite sure how to set up the 2nd one. Any suggestion?