API Troubleshooting

Petrovitch
Petrovitch Expensify Customer Posts: 4 Expensify Newcomer

I'm experiencing an issue using the API. My starting date and ending date are being compared to the Expensify Insert field rather than the create field. By utilizing the date submitted rather than the date of the transaction, I have been able to obtain the desired results by trial and error, but this is not what I want. Any thoughts? Action Email was added to the above scripts for testing.

Comments

  • Sheena Trepanier
    Sheena Trepanier Expensify Team, Approved! Accountant, Expensify Student Ambassador Posts: 1,362 Expensify Team

    Hi @Petrovitch thanks for bringing this to the Community.

    To make sure I understand the purpose of your call, you're creating expenses and adding them to a report, but the report's start and end date are using the insert date of the expense rather than the date of the expenses themselves.

    Do I understand that correctly?

    If so, can you please share the API call you're making (with actual data with secret and userid masked) that caused the issue to occur? Can you also share the ID of the report that was created so I can look at both the start and end of the issue lifecycle?

    If I was offbase in what your API was trying to achieve please just let me know. Our API is very much a self-serve tool but I will try my hardest to help determine if the API is acting incorrectly or not. Thanks!

  • Petrovitch
    Petrovitch Expensify Customer Posts: 4 Expensify Newcomer

    I believe you have it right, yes. The records that are returned when I use C# code to call the API are based on the INSERTED date rather than the CREATED date. There is strange twist that I need to explain. The responses are based on the CREATED date as I would anticipate when I use Postman to call the API. When I use Postman and C# to contact the API, I use the identical scripts, but the outcomes are different.

    I don't get any results when I call the API in C# using the CREATED date as my start date and end date. When I use the INSERTED date, for instance, 11/03/2022, I receive the desired records.

    Naturally, I want my query's key to be the CREATED date.

    Note: The Request and Template are attached to my first message.  


    Attached: 

    1. API Call from C# (multipart Request/Tempate) [Requesting all APPROVED reports]

    2. Worksheet illustrating CREATED, INSERTED dates

    3. Report of sample reports.

    4. Details of the two approved reports.

    5. Some Postman Variables (excluding confidential information)

    6. Results from Postman 


    Note: all transactions were created on 11/02/2022, but submitted (inserted) on 11/0

    3/2022 and 11/22/2022.

  • Petrovitch
    Petrovitch Expensify Customer Posts: 4 Expensify Newcomer

    Many of these topics have been resolved. Our code and Postman now return the same results. However, these results do not reflect what is expected. We are retrieving approved transactions from reports. If the start date is earlier than the generated or inserted dates in Expensify, the transaction is cancelled. The example group contains two transactions. The submissions were received on November 2. The first one was turned in on November 3 and the second one on November 22. If we perform a search for a start/end date of November 1, both results will be shown as they are below the limit made or submitted. Because it is later than either the creation or insertion date, a start/ending date search for November 23 produces no results. That being the case, why do our API requests have a start date and an end date? The meaning of start date and end date is not clear in the documentation.


  • Sasha Kluger
    Sasha Kluger Expensify Success Coach - Admin Posts: 126 Expensify Team

    Hi @Petrovitch, the startDate and endDate used in the API request are used for filtering which reports to include in the response, and those startDate and endDate parameters are based on the report submission date (or report creation date for unsubmitted/Open reports).

    As an example, if you use a startDate of Nov 23, then we will return any reports that were submitted on or after Nov 23.

    Does that help to clarify what's going on?