Source Code Bundles
B2 Integration Checklist
Tools that integrate with B2 and want to be featured on the B2 integrations page need to follow these guidelines:
During an upload using the
Developers do not need to call
Detailed information and pseudo-code examples can be found in the Uploading section of the B2 API documentation.
Set a User-Agent
The common syntax is:
User-Agent: <product> / <product-version+dependencies> <comment>
For example, the
If your tool is uploading many files, the best performance will be achieved by multithreading the upload and launching multiple threads simultaneously.
Downloads over 200MB should be split into parts and downloaded simultaneously. Once all parts are downloaded, the large file should be stitched together.
Handling error response status codes
See the Calling the API page section on Error Handling for a general description of error code classes. Some specific things to check in your integration are:
Managing metadata for interoperability
Setting consistent and appropriate metadata when uploading files will allow for different B2 clients, the B2 web user interface and the B2 Command Line Tool to interoperate correctly. Metadata is set as an HTTP request header when uploading files. Metadata in B2 is immutable.
Deleting file versions
B2 automatically creates versions of files uploaded to the same bucket, with the same name.
If your application allows a user to delete a file and there are multiple versions of that file, it's probably best to ask the user if they want to delete the last version or all versions.
Note: Language libraries and API wrappers for B2 should handle all of these conditions in the lower levels of the code, giving developers higher level constructs for their code.
Timing background work
If you are doing background work, like file synchronization, which contacts the B2 api regularly, please select a random time during your sync period to do the background work.
For instance, if you want to synchronize once an hour, please do not just start your work during the first minute of the hour. Instead, please select a random minute of the hour (let's say the '26th' minute) and do your synchronization starting at that minute. Please select the minutes independently for each of your clients. This helps spread out the load on the B2 service so that we can provide a higher-quality of service to all users.