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

Notifications

Announcements

Community site session details

Community site session details

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

Can't update attachment with API v2

(0) ShareShare
ReportReport
Posted on by
Using API v2 and `PATCH` to update attachments, keep getting corrupted files. 
I'm using javascript with this logic to create the stream: 
    const readableStream = new Readable();
    // eslint-disable-next-line @typescript-eslint/no-empty-function
    readableStream._read = () => {};
    readableStream.push(fileContent);
    readableStream.push(null);
 
This is the headers: 
Accept: 'application/json',
      'Content-Type': 'application/json; odata.metadata=minimal; odata.streaming=true',
      'IF-MATCH': '*',
      'User-Agent': 'axios/0.26.0',
      'Content-Length': 413658

 
 
What am I doing wrong?
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    97,168 Super User 2025 Season 2 on at
    Hi, I suspect it's an Endpoint problem.
    The first thing to note is that this standard Attachment API is not Document Attachment (table 1173), but Incoming Document (table 130). Second, this requires specifying the parent ID.
     
    Although not exactly the same, I mention this in the post below in hopes of giving you some tips.
    How to automatically upload files from OneDrive to Business Central with Power Automate (No customization)
    https://yzhums.com/39365/
     
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,069

#2
Dhiren Nagar Profile Picture

Dhiren Nagar 1,222

#3
YUN ZHU Profile Picture

YUN ZHU 1,033 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans