Announcements
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
Hi, I think it's because the page is set with the following properties.
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
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
As i said i think it says salesInvoices and not salesInvoice.
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
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?
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
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
The first step would be to actually see if there is one attached
Then we would like to use the /content
What are you trying to do with the attached pdf? Are you trying to resend?
André Arnaud de Cal... 291,359 Super User 2024 Season 2
Martin Dráb 230,370 Most Valuable Professional
nmaenpaa 101,156