<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: MergeDrive</title>
    <description>The latest articles on DEV Community by MergeDrive (@mergedrive).</description>
    <link>https://dev.to/mergedrive</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4262185%2F13057565-5817-4865-8fab-609f5ca8cb6f.png</url>
      <title>DEV Community: MergeDrive</title>
      <link>https://dev.to/mergedrive</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mergedrive"/>
    <language>en</language>
    <item>
      <title>How to Design a Resumable File Upload API for Google Drive and OneDrive</title>
      <dc:creator>MergeDrive</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:29:56 +0000</pubDate>
      <link>https://dev.to/mergedrive/how-to-design-a-resumable-file-upload-api-for-google-drive-and-onedrive-5dpg</link>
      <guid>https://dev.to/mergedrive/how-to-design-a-resumable-file-upload-api-for-google-drive-and-onedrive-5dpg</guid>
      <description>&lt;p&gt;Imagine uploading a 2 GB video to cloud storage. The upload reaches 95%, your internet connection drops, and the entire process starts again from zero.&lt;/p&gt;

&lt;p&gt;For users, this is frustrating. For developers, it represents wasted bandwidth, unnecessary requests, and a poor user experience.&lt;/p&gt;

&lt;p&gt;A resumable file upload API can help solve this problem.&lt;/p&gt;

&lt;p&gt;I'm the founder of &lt;a href="https://mergedrive.online/" rel="noopener noreferrer"&gt;MergeDrive&lt;/a&gt;, a multi-cloud storage project involving Google Drive and OneDrive. Upload reliability, storage availability, and managing multiple connected accounts are particularly relevant challenges in this problem space.&lt;/p&gt;

&lt;p&gt;In this article, we'll explore how developers can design a reliable cloud storage file upload API.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is a Resumable File Upload?
&lt;/h2&gt;

&lt;p&gt;A resumable file upload allows an interrupted file transfer to continue from a previously confirmed position instead of restarting the entire upload.&lt;/p&gt;

&lt;p&gt;The process generally involves:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Creating an upload session.&lt;/li&gt;
&lt;li&gt;Dividing the file into smaller chunks.&lt;/li&gt;
&lt;li&gt;Uploading those chunks.&lt;/li&gt;
&lt;li&gt;Tracking the data successfully received by the destination.&lt;/li&gt;
&lt;li&gt;Resuming from the confirmed position after an interruption.&lt;/li&gt;
&lt;li&gt;Finalizing the upload.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The key difference is that upload progress can survive certain network interruptions, provided the upload session and original file data remain available.&lt;/p&gt;

&lt;h2&gt;
  
  
  Traditional Uploads vs. Resumable Uploads
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Traditional single-request upload&lt;/th&gt;
&lt;th&gt;Resumable upload&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Transfer method&lt;/td&gt;
&lt;td&gt;Entire file in one request&lt;/td&gt;
&lt;td&gt;Multiple requests supported&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Network interruption&lt;/td&gt;
&lt;td&gt;Often requires restarting&lt;/td&gt;
&lt;td&gt;Can resume an active session&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Progress tracking&lt;/td&gt;
&lt;td&gt;Usually request-based&lt;/td&gt;
&lt;td&gt;Server-confirmed progress&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Large file handling&lt;/td&gt;
&lt;td&gt;More vulnerable to interruptions&lt;/td&gt;
&lt;td&gt;Better suited to long transfers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Implementation&lt;/td&gt;
&lt;td&gt;Simpler&lt;/td&gt;
&lt;td&gt;More complex&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Session management&lt;/td&gt;
&lt;td&gt;Usually unnecessary&lt;/td&gt;
&lt;td&gt;Required&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For small files, traditional uploads may be sufficient.&lt;/p&gt;

&lt;p&gt;For large videos, documents, backups, and unreliable network connections, resumable uploads offer significant practical advantages.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftasp4faey8ppdpofof8w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftasp4faey8ppdpofof8w.jpg" alt=" " width="799" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Designing the Upload Architecture
&lt;/h2&gt;

&lt;p&gt;A reliable file upload system can contain several independent components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client application.&lt;/li&gt;
&lt;li&gt;File upload API.&lt;/li&gt;
&lt;li&gt;Upload job queue.&lt;/li&gt;
&lt;li&gt;Storage destination selector.&lt;/li&gt;
&lt;li&gt;Upload session manager.&lt;/li&gt;
&lt;li&gt;Provider-specific storage adapters.&lt;/li&gt;
&lt;li&gt;Upload status database.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A simplified architecture might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Client Application
        |
    Upload API
        |
   Upload Queue
        |
Storage Destination Selector
        |
Upload Session Manager
        |
        +-- Google Drive API
        |
        +-- Microsoft Graph API
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Separating these responsibilities makes it easier to manage failures, retries, scheduling, and different storage providers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Maintain Upload Session State
&lt;/h2&gt;

&lt;p&gt;A resumable upload service needs to maintain information about each upload.&lt;/p&gt;

&lt;p&gt;For example, a TypeScript model could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;UploadStatus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"queued"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"uploading"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"paused"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"completed"&lt;/span&gt;
  &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"failed"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;UploadJob&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;fileName&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;totalBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;confirmedBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"google-drive"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"onedrive"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UploadStatus&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;scheduledAt&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;sessionExpiresAt&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Persisting this metadata allows the application to recover upload state after a worker or application restart.&lt;/p&gt;

&lt;p&gt;However, metadata alone is not enough. The original file data must also remain accessible to the upload worker.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Split Large Files Into Chunks
&lt;/h2&gt;

&lt;p&gt;Instead of loading an entire large file into memory, an application can process smaller portions.&lt;/p&gt;

&lt;p&gt;Here is an illustrative browser-side chunk generator:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nf"&gt;createChunks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Blob&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;chunkSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isSafeInteger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;chunkSize&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
    &lt;span class="n"&gt;chunkSize&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Invalid chunk size"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;chunkSize&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;chunkSize&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;size&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;yield&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;endExclusive&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;end&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates portions of the original file without requiring the entire file to be loaded into a single JavaScript buffer.&lt;/p&gt;

&lt;p&gt;The appropriate chunk size depends on the destination provider and its upload requirements.&lt;/p&gt;

&lt;p&gt;Server-side applications can use streams or controlled file reads instead.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Resume From Server-Confirmed Progress
&lt;/h2&gt;

&lt;p&gt;One important mistake to avoid is assuming that every byte sent by the client has been successfully stored by the destination.&lt;/p&gt;

&lt;p&gt;Suppose a file upload is interrupted:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Total file size: 1,000 MiB.&lt;/li&gt;
&lt;li&gt;Client attempted to send: 650 MiB.&lt;/li&gt;
&lt;li&gt;Cloud provider confirmed: 640 MiB.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The application should resume according to the provider's reported upload state, not the client's attempted progress.&lt;/p&gt;

&lt;p&gt;Otherwise, the upload may skip missing data or submit incorrect byte ranges.&lt;/p&gt;

&lt;p&gt;A simple progress calculation could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getProgress&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;confirmedBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;totalBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;totalBytes&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;confirmedBytes&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;totalBytes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only confirmed progress should be persisted as successfully uploaded data.&lt;/p&gt;

&lt;p&gt;The application should mark a job as completed only after the provider confirms successful file creation or finalization.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Handle Google Drive and OneDrive Differently
&lt;/h2&gt;

&lt;p&gt;Although both providers support resumable file uploads, their underlying implementations differ.&lt;/p&gt;

&lt;h3&gt;
  
  
  Google Drive File Upload API
&lt;/h3&gt;

&lt;p&gt;Google Drive supports resumable upload sessions.&lt;/p&gt;

&lt;p&gt;The application creates a session and sends file content to the returned session URI.&lt;/p&gt;

&lt;p&gt;An HTTP 308 response during the upload indicates that additional data is still required. The application can inspect the returned range information or query the session to determine where to continue.&lt;/p&gt;

&lt;p&gt;Official documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://developers.google.com/workspace/drive/api/guides/manage-uploads" rel="noopener noreferrer"&gt;https://developers.google.com/workspace/drive/api/guides/manage-uploads&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Microsoft OneDrive Upload API
&lt;/h3&gt;

&lt;p&gt;OneDrive supports large file uploads through Microsoft Graph upload sessions.&lt;/p&gt;

&lt;p&gt;The session provides an upload URL and expiration information. The application transfers file portions and uses the session's missing-range information to recover from interruptions.&lt;/p&gt;

&lt;p&gt;Microsoft Graph also has specific chunk alignment requirements, including 320 KiB alignment for non-final fragments.&lt;/p&gt;

&lt;p&gt;Official documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession" rel="noopener noreferrer"&gt;https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A unified cloud storage API can expose consistent upload states while keeping these provider-specific requirements inside separate adapters.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Introduce a Priority File Upload Queue
&lt;/h2&gt;

&lt;p&gt;Not every upload has the same urgency.&lt;/p&gt;

&lt;p&gt;Consider a SaaS application processing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;An urgent customer document.&lt;/li&gt;
&lt;li&gt;A large video upload.&lt;/li&gt;
&lt;li&gt;A scheduled backup.&lt;/li&gt;
&lt;li&gt;Multiple background file transfers.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A priority upload queue can help determine which jobs should be processed first.&lt;/p&gt;

&lt;p&gt;Here is a simplified job selection function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getNextUpload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;jobs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UploadJob&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;now&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;UploadJob&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;undefined&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;jobs&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
      &lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"queued"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scheduledAt&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt;
        &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;job&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;scheduledAt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;now&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;priority&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example selects eligible jobs according to priority and scheduled execution time.&lt;/p&gt;

&lt;p&gt;A production queue would also need to handle concurrent workers, atomic job claiming, retry limits, fairness, and worker failures.&lt;/p&gt;

&lt;p&gt;Priority scheduling should not permanently prevent lower-priority jobs from completing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Select the Right Cloud Storage Destination
&lt;/h2&gt;

&lt;p&gt;Multi-cloud applications introduce another challenge: deciding where a file should be uploaded.&lt;/p&gt;

&lt;p&gt;Consider three connected cloud accounts:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cloud account&lt;/th&gt;
&lt;th&gt;Available storage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Google Drive A&lt;/td&gt;
&lt;td&gt;2 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Drive B&lt;/td&gt;
&lt;td&gt;12 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OneDrive&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a 6 GB upload, only Google Drive B has sufficient available capacity.&lt;/p&gt;

&lt;p&gt;A smart upload service can evaluate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Available storage.&lt;/li&gt;
&lt;li&gt;User-defined account preferences.&lt;/li&gt;
&lt;li&gt;File size.&lt;/li&gt;
&lt;li&gt;Account permissions.&lt;/li&gt;
&lt;li&gt;Provider limitations.&lt;/li&gt;
&lt;li&gt;Concurrent upload reservations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Remember that the combined available space across multiple accounts does not automatically become one physical storage quota.&lt;/p&gt;

&lt;p&gt;Storage selection is also different from resumability. Switching to a different provider after an interrupted upload generally requires a new upload session.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Handle Upload Failures Properly
&lt;/h2&gt;

&lt;p&gt;Not every failed upload should be retried in the same way.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Failure&lt;/th&gt;
&lt;th&gt;Recommended response&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Network interruption&lt;/td&gt;
&lt;td&gt;Query session and resume&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rate limit&lt;/td&gt;
&lt;td&gt;Respect retry instructions and back off&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Temporary server error&lt;/td&gt;
&lt;td&gt;Retry with bounded exponential backoff&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Insufficient storage&lt;/td&gt;
&lt;td&gt;Reevaluate destination or notify user&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expired upload session&lt;/td&gt;
&lt;td&gt;Create a new session if appropriate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Permission denied&lt;/td&gt;
&lt;td&gt;Request authorization or stop&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Before retrying an ambiguous failure near upload completion, check whether the file was already created.&lt;/p&gt;

&lt;p&gt;This helps avoid accidentally creating duplicate files.&lt;/p&gt;

&lt;p&gt;Upload session URLs should also be treated as sensitive credentials and kept out of application logs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: Notify Applications About Upload Completion
&lt;/h2&gt;

&lt;p&gt;For long-running file uploads, background processing can be more practical than holding an HTTP request open.&lt;/p&gt;

&lt;p&gt;Applications can expose upload status through polling or application-level webhooks.&lt;/p&gt;

&lt;p&gt;An illustrative completion event might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"event"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"upload.completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"uploadId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"upload_123"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"google-drive"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"completed"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A production webhook system should support authentication, retry handling, and duplicate event detection.&lt;/p&gt;

&lt;p&gt;This is an example event design, not an official MergeDrive API response.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where MergeDrive Fits Into This Architecture
&lt;/h2&gt;

&lt;p&gt;The cloud storage management project I'm developing, MergeDrive, addresses several related problem areas:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Managing multiple Google Drive and OneDrive accounts.&lt;/li&gt;
&lt;li&gt;Smart storage destination selection.&lt;/li&gt;
&lt;li&gt;Account prioritization.&lt;/li&gt;
&lt;li&gt;Priority and scheduled uploads.&lt;/li&gt;
&lt;li&gt;Resumable file uploads.&lt;/li&gt;
&lt;li&gt;Storage availability monitoring.&lt;/li&gt;
&lt;li&gt;Unified cloud storage API and webhooks.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These capabilities illustrate how upload reliability, account management, and storage orchestration can be treated as connected engineering problems.&lt;/p&gt;

&lt;p&gt;Project context: &lt;a href="https://mergedrive.online/" rel="noopener noreferrer"&gt;MergeDrive&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The implementation examples in this article are general architectural illustrations, not excerpts from MergeDrive's production code or its documented API contracts.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Readiness Checklist
&lt;/h2&gt;

&lt;p&gt;Before deploying a resumable file upload API, test scenarios such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Network interruption halfway through an upload.&lt;/li&gt;
&lt;li&gt;Application or worker restart.&lt;/li&gt;
&lt;li&gt;Expired upload sessions.&lt;/li&gt;
&lt;li&gt;Insufficient destination storage.&lt;/li&gt;
&lt;li&gt;Simultaneous uploads to the same account.&lt;/li&gt;
&lt;li&gt;Provider rate limiting.&lt;/li&gt;
&lt;li&gt;Duplicate completion notifications.&lt;/li&gt;
&lt;li&gt;Cancellation during an upload.&lt;/li&gt;
&lt;li&gt;Loss of access to the original file data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A successful upload under ideal conditions is only the beginning. Reliability comes from handling the unexpected conditions correctly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A reliable cloud storage file upload API requires more than a simple upload endpoint.&lt;/p&gt;

&lt;p&gt;Resumable transfers, persistent session state, provider-specific adapters, priority queues, smart storage selection, and failure recovery can work together to create a more resilient system.&lt;/p&gt;

&lt;p&gt;Start with the simplest reliable upload workflow, then introduce scheduling, prioritization, and multi-cloud orchestration as your requirements grow.&lt;/p&gt;

&lt;p&gt;How do you handle interrupted large file uploads in your applications? Do you manage upload sessions yourself or rely on provider SDKs?&lt;/p&gt;




&lt;p&gt;Disclosure: I am the founder of MergeDrive. This article was drafted using AI. The code examples are illustrative and should be reviewed and tested before production use.&lt;/p&gt;

</description>
      <category>api</category>
      <category>backend</category>
      <category>cloud</category>
      <category>typescript</category>
    </item>
    <item>
      <title># Unified Cloud Storage API: Integrating Google Drive and OneDrive With a Single Interface</title>
      <dc:creator>MergeDrive</dc:creator>
      <pubDate>Tue, 24 Nov 2026 12:03:04 +0000</pubDate>
      <link>https://dev.to/mergedrive/-unified-cloud-storage-api-integrating-google-drive-and-onedrive-with-a-single-interface-9lo</link>
      <guid>https://dev.to/mergedrive/-unified-cloud-storage-api-integrating-google-drive-and-onedrive-with-a-single-interface-9lo</guid>
      <description>&lt;p&gt;Integrating one cloud storage provider into a SaaS application is relatively straightforward. Integrating multiple providers while maintaining a consistent developer experience is a different challenge.&lt;/p&gt;

&lt;p&gt;Each provider has its own authentication mechanisms, file management endpoints, upload workflows, error responses, and limitations.&lt;/p&gt;

&lt;p&gt;I'm the founder and developer of &lt;a href="https://mergedrive.online/" rel="noopener noreferrer"&gt;MergeDrive&lt;/a&gt;, a multi-cloud storage management project involving Google Drive and OneDrive. This article explores the architectural challenges relevant to building such a platform.&lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;What is a unified cloud storage API?&lt;/li&gt;
&lt;li&gt;Challenges of multi-cloud integration&lt;/li&gt;
&lt;li&gt;Designing a unified API&lt;/li&gt;
&lt;li&gt;Smart storage selection&lt;/li&gt;
&lt;li&gt;Resumable file uploads&lt;/li&gt;
&lt;li&gt;Webhooks and asynchronous operations&lt;/li&gt;
&lt;li&gt;Security considerations&lt;/li&gt;
&lt;li&gt;MergeDrive as a project context&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. What Is a Unified Cloud Storage API?
&lt;/h2&gt;

&lt;p&gt;A unified cloud storage API provides a common interface for interacting with multiple cloud storage providers.&lt;/p&gt;

&lt;p&gt;Instead of implementing provider-specific logic throughout your application, you introduce an abstraction layer that handles the differences between providers.&lt;/p&gt;

&lt;p&gt;A unified interface can expose common operations such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File uploads and downloads.&lt;/li&gt;
&lt;li&gt;File and folder management.&lt;/li&gt;
&lt;li&gt;Storage availability monitoring.&lt;/li&gt;
&lt;li&gt;File metadata retrieval.&lt;/li&gt;
&lt;li&gt;Cloud account management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The underlying adapters communicate with the respective cloud storage APIs.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Challenges of Multi-Cloud Storage Integration
&lt;/h2&gt;

&lt;p&gt;Google Drive and OneDrive provide similar storage capabilities but implement them differently.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Capability&lt;/th&gt;
&lt;th&gt;Google Drive&lt;/th&gt;
&lt;th&gt;OneDrive&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;API&lt;/td&gt;
&lt;td&gt;Google Drive API&lt;/td&gt;
&lt;td&gt;Microsoft Graph&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Authentication&lt;/td&gt;
&lt;td&gt;Google OAuth 2.0&lt;/td&gt;
&lt;td&gt;Microsoft identity platform&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File identifiers&lt;/td&gt;
&lt;td&gt;File IDs&lt;/td&gt;
&lt;td&gt;DriveItem IDs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Large file uploads&lt;/td&gt;
&lt;td&gt;Resumable uploads&lt;/td&gt;
&lt;td&gt;Upload sessions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Supporting both providers requires handling differences in:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OAuth permissions and token refresh.&lt;/li&gt;
&lt;li&gt;API response structures.&lt;/li&gt;
&lt;li&gt;Pagination.&lt;/li&gt;
&lt;li&gt;Rate limits.&lt;/li&gt;
&lt;li&gt;File size restrictions.&lt;/li&gt;
&lt;li&gt;Error handling.&lt;/li&gt;
&lt;li&gt;Upload session management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A unified cloud storage API can centralize much of this complexity.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Designing a Unified Cloud Storage API
&lt;/h2&gt;

&lt;p&gt;The adapter design pattern provides a useful architectural foundation.&lt;/p&gt;

&lt;p&gt;A common TypeScript interface could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;CloudProvider&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"google-drive"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"onedrive"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;CloudFile&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;CloudProvider&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;size&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;StorageAdapter&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;upload&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CloudFile&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;listFiles&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CloudFile&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nf"&gt;deleteFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;accountId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;fileId&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;
  &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="k"&gt;void&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a conceptual interface, not the actual MergeDrive SDK or API contract.&lt;/p&gt;

&lt;p&gt;Each provider implements its own adapter while the application communicates through the common interface.&lt;/p&gt;

&lt;p&gt;The architecture looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SaaS Application
       |
Unified Storage API
       |
       +-- Google Drive Adapter
       |          |
       |     Google Drive API
       |
       +-- OneDrive Adapter
                  |
             Microsoft Graph
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This approach separates application logic from provider-specific implementation details.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Smart Storage Selection
&lt;/h2&gt;

&lt;p&gt;A multi-cloud API can do more than normalize endpoints.&lt;/p&gt;

&lt;p&gt;It can also help determine which connected account should receive a file.&lt;/p&gt;

&lt;p&gt;Consider the following scenario:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Account&lt;/th&gt;
&lt;th&gt;Available storage&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Google Drive A&lt;/td&gt;
&lt;td&gt;0 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Drive B&lt;/td&gt;
&lt;td&gt;10 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OneDrive A&lt;/td&gt;
&lt;td&gt;4 GB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;For a 6 GB upload, Google Drive B has sufficient capacity.&lt;/p&gt;

&lt;p&gt;A simple storage selection algorithm could look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;StorageAccount&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;availableBytes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;selectAccount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="n"&gt;accounts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;StorageAccount&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;fileSize&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;accounts&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
      &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;availableBytes&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;fileSize&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;priority&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;priority&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A production implementation would also need to consider permissions, provider limitations, concurrent uploads, and changing storage availability.&lt;/p&gt;

&lt;p&gt;Importantly, managing multiple cloud accounts does not physically combine their individual storage quotas.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Why Resumable Upload APIs Matter
&lt;/h2&gt;

&lt;p&gt;Large file uploads can fail because of network interruptions, temporary API failures, or expired sessions.&lt;/p&gt;

&lt;p&gt;Restarting an entire upload consumes unnecessary bandwidth and time.&lt;/p&gt;

&lt;p&gt;Google Drive supports resumable uploads, while Microsoft Graph provides upload sessions.&lt;/p&gt;

&lt;p&gt;A unified upload service can track:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Upload session identifiers.&lt;/li&gt;
&lt;li&gt;Confirmed byte offsets.&lt;/li&gt;
&lt;li&gt;Upload progress.&lt;/li&gt;
&lt;li&gt;Retry attempts.&lt;/li&gt;
&lt;li&gt;Session expiration.&lt;/li&gt;
&lt;li&gt;Completion status.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Priority queues and scheduled uploads are additional architectural options for applications handling multiple concurrent upload requests.&lt;/p&gt;

&lt;p&gt;For large files, production systems should also consider streaming or chunked processing instead of loading the entire file into memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  6. Cloud Storage Webhooks and Asynchronous Operations
&lt;/h2&gt;

&lt;p&gt;Large uploads and background storage operations may not complete within a single HTTP request.&lt;/p&gt;

&lt;p&gt;An asynchronous architecture can use background jobs and application-level webhooks to communicate operation status.&lt;/p&gt;

&lt;p&gt;An illustrative webhook payload might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"event"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"upload.completed"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"eventId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"evt_example"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"fileId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"file_example"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"provider"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"google-drive"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"completed"&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This example represents a hypothetical application-level event, not a documented MergeDrive webhook payload.&lt;/p&gt;

&lt;p&gt;Reliable webhook implementations should support signature verification, retry handling, duplicate event detection, and idempotent processing.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Security Considerations
&lt;/h2&gt;

&lt;p&gt;Cloud storage integrations require careful handling of user credentials and files.&lt;/p&gt;

&lt;p&gt;Important considerations include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Secure OAuth token storage.&lt;/li&gt;
&lt;li&gt;Minimum required permission scopes.&lt;/li&gt;
&lt;li&gt;Account ownership verification.&lt;/li&gt;
&lt;li&gt;File-level authorization.&lt;/li&gt;
&lt;li&gt;Customer data isolation.&lt;/li&gt;
&lt;li&gt;Webhook signature verification.&lt;/li&gt;
&lt;li&gt;Access revocation.&lt;/li&gt;
&lt;li&gt;Protection against unauthorized downloads.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For collaborative applications, viewer and contributor permissions can help distinguish read access from file submission capabilities.&lt;/p&gt;

&lt;p&gt;Scheduled access revocation is another useful design consideration for temporary collaborations.&lt;/p&gt;

&lt;h2&gt;
  
  
  8. MergeDrive: A Multi-Cloud Storage Project
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://mergedrive.online/" rel="noopener noreferrer"&gt;MergeDrive&lt;/a&gt; is the project I'm developing in this problem space.&lt;/p&gt;

&lt;p&gt;It brings together several areas discussed in this article:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Area&lt;/th&gt;
&lt;th&gt;Relevant functionality&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Multi-cloud management&lt;/td&gt;
&lt;td&gt;Google Drive and OneDrive account integration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Developer integration&lt;/td&gt;
&lt;td&gt;Unified cloud storage API and webhooks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Upload orchestration&lt;/td&gt;
&lt;td&gt;Smart storage selection, priority, scheduled and resumable uploads&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Storage management&lt;/td&gt;
&lt;td&gt;Account prioritization and storage monitoring&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Collaboration&lt;/td&gt;
&lt;td&gt;Viewer and contributor permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Access lifecycle&lt;/td&gt;
&lt;td&gt;Manual and scheduled sharing access revocation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;File protection&lt;/td&gt;
&lt;td&gt;Secondary file copies&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These capabilities illustrate why a multi-cloud platform involves more than simply forwarding API requests to different providers.&lt;/p&gt;

&lt;p&gt;The code in this article describes general architectural patterns. For actual MergeDrive capabilities and integration contracts, refer to the project's documentation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Project website:&lt;/strong&gt; &lt;a href="https://mergedrive.online/" rel="noopener noreferrer"&gt;https://mergedrive.online/&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Conclusion
&lt;/h2&gt;

&lt;p&gt;A unified cloud storage API can simplify multi-provider integration by separating business logic from provider-specific implementations.&lt;/p&gt;

&lt;p&gt;However, abstraction alone is not enough.&lt;/p&gt;

&lt;p&gt;A reliable architecture also needs to account for storage availability, upload reliability, authentication, asynchronous operations, error handling, and access control.&lt;/p&gt;

&lt;p&gt;Start with a small interface, implement provider adapters, and introduce additional capabilities as your application's requirements evolve.&lt;/p&gt;

&lt;p&gt;How are you handling multiple cloud storage providers in your applications? Are you using separate integrations or a unified abstraction layer?&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/workspace/drive/api/guides/manage-uploads" rel="noopener noreferrer"&gt;Google Drive API — Upload file data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession" rel="noopener noreferrer"&gt;Microsoft Graph — Upload sessions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/workspace/drive/api/guides/about-sdk" rel="noopener noreferrer"&gt;Google Drive API documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Disclosure: I am the founder of MergeDrive. This article was drafted with AI assistance. The code examples are illustrative architectural examples, not tested production code or official MergeDrive API contracts.&lt;/p&gt;

</description>
      <category>api</category>
      <category>webdev</category>
      <category>architecture</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
