Skip to main content

Notifications

Small and medium business | Business Central, N...
Answered

Business Central API pdfDocument "BadRequest_NotFound"

Posted on by 501

I have a Business Central v18.0 On-Prem client that wants to use the pdfDocument functionality in an API to download reports. 

I have configured my Postman API setup to retrieve the Sales Invoice Data, which worked great. I was able to retrieve the information. Th

http://*********/UAT/api/beta/companies(*********)/salesInvoices(4a504f68-e9a6-ed11-8b9a-00155d001620)


pastedimage1681217964957v5.png

According to the Microsoft Documentation https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_pdfdocument_get we only net to add "pdfDocument" and a link with the report will be returned. 
pastedimage1681217406757v2.png

Here is the new URL with pdf documents attached
http://*********/UAT/api/beta/companies(*********)/salesInvoices(4a504f68-e9a6-ed11-8b9a-00155d001620)/pdfDocument

The first time it did work and it did return the URL for the report. The second time I received the following error.
pastedimage1681217909982v4.png

I need to get the reports through a URL. Any assistance to remedy this would be highly appreciated. 
Thanks

Categories:
  • Suggested answer
    Hein Kruger Profile Picture
    Hein Kruger 501 on at
    RE: Business Central API pdfDocument "BadRequest_NotFound"

    For some Reason. APIV2 extension wasn't installed.

    Here is the weird part. The extensions for API are not shown in extension management.

    We got the Microsoft__Exclude_APIV2_.app file from the onPrem download file.

    ..\Applications\APIV2\Source

    After Publishing and installing V2.0 was available on the web service Table =  2000000193

  • Suggested answer
    Gianfranco C. Profile Picture
    Gianfranco C. 370 on at
    RE: Business Central API pdfDocument "BadRequest_NotFound"

    hello, you have to add "/pdfDocumentContent" to the url, as in the attached image:

    pastedimage1681220533151v1.png

    this way you get the file:

    pastedimage1681220657665v2.png

    Don't forget to help the community by Verifying the answer and Like it if your question has been answered. It will let others know that the topic has verified answer.

    Thanks & Regards,
    Gian

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Complete!

🔔 Be sure to subscribe to the new forums you are interested in to stay up to date! 🔔

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,134 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,928 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans