web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Get salesInvoice pdfDocument

(0) ShareShare
ReportReport
Posted on by 423

Hi,

We are trying to follow the steps described here : https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/api-reference/v2.0/api/dynamics_salesquote_pdfdocument to retrieve the PDF document for a sales Invoice

However, we are getting the following error message: The URI segment 'pdfDocument' is invalid after the segment 'salesInvoice({id})

The document has a PDF attached. It was attached by the Attached as PDF action on the sales invoice. I took a look at the Attachment Entity Buffer table and it's empty. What are we missing?

Any help would be appreciated

Thanks

-Julie

  • Dallefeld Profile Picture
    235 User Group Leader on at

    What are you trying to do with the attached pdf? Are you trying to resend?

  • Juliem Profile Picture
    423 on at

    The first step would be to actually see if there is one attached

    Then we would like to use the /content

  • Suggested answer
    JAngle Profile Picture
    161 on at

    The pdfdocument endpoint is just pulling a copy of the documents report layout as a pdf file. The attachment table doesn’t have an api. The one in the documentation is just the incoming documents table. Your requirement would require development

  • Juliem Profile Picture
    423 on at

    I do understand that we will need development. But I thought that using this GET businesscentralPrefix/api/v2.0/companies({id})/salesInvoice({salesInvoiceId})/pdfDocument would at least give us the 200 OK response with the link to the PDF as mentioned on the link. But we are getting an error message instead

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    According to the documentation it should be  'salesInvoices({id}) and  not 'salesInvoice({id}) as you wrote that you are using.

    Maybe that is causing this?

  • Juliem Profile Picture
    423 on at

    The documentation says:

    GET businesscentralPrefix/api/v2.0/companies({id})/salesInvoice({salesInvoiceId})/pdfDocument

    If I understand properly, this needs to match with the web service name.

    if we try GET businesscentralPrefix/api/v2.0/companies({id})/salesInvoice({salesInvoiceId}) without the /pdfDocument at the end, we get the data from that salesInvoice

  • Suggested answer
    IB-29041624-0 Profile Picture
    1,191 Moderator on at

    As i said i think it says salesInvoices and not salesInvoice.

  • Juliem Profile Picture
    423 on at

    The object name is salesInvoices, you are correct but the documentation does not. What is important is the service name of your web service, if I'm not mistaken. I changed it, for the sake of it, but it doesn't change anything to the end result

    GET businesscentralPrefix/api/v2.0/companies({id})/salesInvoices({salesInvoiceId}) does work

    GET businesscentralPrefix/api/v2.0/companies({id})/salesInvoices({salesInvoiceId})/pdfDocument does not

  • Suggested answer
    YUN ZHU Profile Picture
    104,157 Super User 2026 Season 2 on at

    Hi, I think it's because the page is set with the following properties.

    SourceTableTemporary = true;

    pastedimage1643939238496v1.png

    And you can  publish Document Attachment Details (1173, List) or a new page created to webservice and try it again.

    Hope this will help.

    Thanks.

    ZHU

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 570 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 390 Super User 2026 Season 2

#3
Teagen Boll Profile Picture

Teagen Boll 220 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans