Issue on Expense Reports using API from MS Dynamics NAV 2018

rajatmonga
rajatmonga Expensify Customer Posts: 3
edited April 2019 in Integrations and API

Hi Team,

Hope you doing good…!!

We are facing an issue regarding downloading Expense Reports using API from MS Dynamics NAV 2018, as the file is not getting generated on the API request.

Please check on the same and assist, if we are missing something.


Also, Please refer to below for your reference for issue analysis:

  1. a. Attached codeunit Expensify_Integration_Function.txt – Function name GetExpReporstListCURL(), that is being used for downloading expense reports.
  2. API Request Details

"C:\Expensify\curl-7.54.0-win64-mingw\bin\curl.exe" -X POST http://integrations.expensify.com/Integration-Server/ExpensifyIntegrations -d 'requestJobDescription="{type:file,credentials:{partnerUserID:*******,partnerUserSecret:****************************************},onReceive:{ immediateResponse:[returnRandomFileName] },inputSettings:{type:combinedReportData,filters:{startDate:2016-01-01,endDate:2019-12-31}},outputSettings:{ fileExtension:csv, fileBasename:allExpReps },onFinish:[{ actionName:markAsExported, label:Expensify Export }]}' --data-urlencode 'template@C:\Expensify\curl-7.54.0-win64-mingw\bin\expensify_template.ftl' -H Expect:


Regards,

Rajat Monga


Answers

  • Francois Laithier
    Francois Laithier Expensify Team Posts: 33 Expensify Team
    edited April 2019

    Hi Rajat,


    When you executed the curl request, you should have received a response from the Expensify API. Can you please share it here? It should indicate if anything went wrong.


    One thing that looks incorrect with the request so far though is that the value of the requestJobDescription parameter should be valid JSON, so:

    'requestJobDescription="{type:file,credentials:{partnerUserID:xx,partnerUserSecret:yy} (etc.)
    

    should be:

    'requestJobDescription={"type":"file","credentials":{"partnerUserID":"xx","partnerUserSecret":"yy"} (etc.)
    


  • rajatmonga
    rajatmonga Expensify Customer Posts: 3
    edited June 2019

    Hi @Francois,

    Hope you doing good…!!

    As per your update to the issue, I have tried updating the request as below, but still not getting results:

    API Request Details:

    "C:\Expensify\curl-7.54.0-win64-mingw\bin\curl.exe" -X POST http://integrations.expensify.com/Integration-Server/ExpensifyIntegrations -d requestJobDescription="{"type":"file","credentials":{"partnerUserID":"xx","partnerUserSecret":"yy"},"onReceive":{ "immediateResponse":"[returnRandomFileName]" },"inputSettings":{"type":"combinedReportData","filters":{"startDate":"2016-01-01","endDate":"2019-12-31"}},"outputSettings":{ "fileExtension":"csv", "fileBasename":"allExpReps" },"onFinish":"[{ "actionName":"markAsExported", "label":"Expensify Export" }]"}" --data-urlencode "template@C:\Expensify\curl-7.54.0-win64-mingw\bin\expensify_template.ftl" -H "Expect":


    Also, Please attached the response for your reference.


    Please check on the same and assist, if we are missing something.


    Regards,

    Rajat Monga

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

    Hi Rajat,

    Looks like you have an issue with the format of the request and the double quotes, so curl cannot execute the request at all. You might be able to find help on how to format curl requests on Windows here, here, or here.

    Cheers

  • rajatmonga
    rajatmonga Expensify Customer Posts: 3

    Hi Team,

    As per update from Francois, the issue is still not resolved.

    Please check on the same and assist, if we are missing something.

    Also, Please refer to below for your reference for issue analysis:

    1.  Attached codeunit Expensify_Integration_Function.txt – Function name GetExpReporstListCURL(), that is being used for downloading expense reports.

        2. API Request:

    "C:\Expensify\curl-7.54.0-win64-mingw\bin\curl.exe" -X POST https://integrations.expensify.com -d requestJobDescription={"type":"file","credentials":{"partnerUserID":"aa_rajat_inecta_com","partnerUserSecret":"cec4183e990b1e4efb2d6899f59287c407f55a26"},"onReceive":{"immediateResponse":["returnRandomFileName"]},"inputSettings":{"type":"combinedReportData","filters":{"startDate":"2016-01-01","endDate":"2019-12-31"}},"outputSettings":{"fileExtension":"csv", "fileBasename":"allExpReps"},"onFinish":[{"actionName":"markAsExported", "label":"Expensify Export"}]} --data-urlencode "template@C:\Expensify\curl-7.54.0-win64-mingw\bin\expensify_template.ftl" -H Expect:


    3. CURL Response.jpg


    Regards,

    Rajat Monga