This package provides a programmatically generated wrapper for the Dropbox V2 API, specifically designed for Node.js environments. It aims to keep the API surface up-to-date by automatically generating PRs when the official Dropbox endpoint descriptions change. Currently at version 2.5.12, it follows a continuous update model for its API generation, ensuring parity with the Dropbox API. Key differentiators include full support for Node.js streams for efficient file uploads and downloads, direct support for the Dropbox Paper API, and a simple, direct mapping of official Dropbox API resource names. It avoids custom function names, instead relying on a structured object for resource and parameter definitions. The package supports both token-based authentication and the full OAuth2 flow, including refresh token management for offline access. It is primarily consumed as a CommonJS module.
npm install dropbox-v2-apiVerified import paths — ran on the pinned version, not inferred.
This example demonstrates authenticating with a Dropbox token, fetching current account details, and uploading a local file to Dropbox using Node.js streams. It highlights the basic API call structure.
Refer to the official Dropbox API documentation or the library's `api.json` for the most accurate resource names and parameters, especially after any library updates.
Ensure all API calls and concepts align with Dropbox API v2 documentation. Migrate any legacy v1 codebases to v2 before using this library.
Verify that your access token is current and has the necessary scopes. Implement refresh token logic for long-lived access if using OAuth2, by calling `dropbox.refreshToken()` with the stored `refresh_token`.
Always provide a `fs.createReadStream()` or similar readable stream for upload resources. For downloads, ensure you pipe the returned stream to a writable destination, e.g., `fs.createWriteStream()`.
Set `NODE_TLS_REJECT_UNAUTHORIZED='0'` (NOT recommended for production) or configure Node.js to trust the custom CA certificate by setting the `NODE_EXTRA_CA_CERTS` environment variable.
Obtain a new access token, verify its validity, and ensure it has all the required Dropbox API scopes (e.g., `files.content.read`, `files.content.write`, `account_info.read`) for the endpoints you are calling.
Double-check the `path` parameter in your API call. Ensure the path exists and is correctly formatted according to Dropbox's path rules. Verify that the application has permissions to access that specific path.
Ensure you first call `const dropbox = dropboxV2Api.authenticate({ token: '...' });` and then use the `dropbox` constant as the function to make API requests.No dependency data recorded yet.