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

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
    98,574 Super User 2026 Season 1 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

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 1,822 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,136 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 956 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans