API & SDK & Tools
How to locate the error response of BOS?
When an error occurs during BOS access, the error code and error information will be returned from BOS to help users identify error. For detailed explanation for error code and error message, please refer to [Error Code](BOS/API Reference/Error code.md).
When API or SDK is used to upload an object, how to judge whether the object is uploaded successfully?
- When API is used to upload an object, if the returned value is 200, it indicates the upload has been successfully completed, and [GetobjectMeta API](BOS/API Reference/Object-Related Interface/Basic Operations/GetObjectMeta.md) can be used to verify whether the object exists or not.
- When the SDK is used to upload an object and no exception occurs, it means the upload has been successfully completed. Refer to the "Get object Meta Information" in the SDK documentation to confirm whether the object exists.
What's the difference between such upload APIs: PutObject, PostObject, AppendObject, and MultipartUpload ?
These upload APIs can all handle file uploads. Their main differences are detailed below:
- PutObject is generally used to upload small files.
- PutObject is especially suitable for uploading files in a browser-based environment.
- AppendObject is designed for incremental upload scenarios, such as real-time uploads of surveillance videos or log files. Appendable files can be accessed and viewed at any time.
- MultipartUpload is intended for uploading large files. This method involves splitting a large file into parts and uploading each part separately, thereby enhancing both the success rate and the upload speed. Note that files uploaded using MultipartUpload will not be viewable in ListObjects until the entire upload process (commit) is completed.
How to copy data across buckets?
The API supported by [BOS Copyobject](BOS/API Reference/Object-Related Interface/Basic Operations/CopyObject.md) can realize the data copy. In order to facilitate your use, BOS console, CLI and SDK are encapsulated such APIs. When you need to copy a large number of files across buckets, you can make it through SDK. First, get the list of files to be copied from ListObject, and then copy with CopyObject. It shall be noted that, you need to have the read permission for source files and write permission for target files in order to execute CopyObject. If the target bucket is owned by another user, you can ask the owner to set ACL for his/her bucket to allow you for writing. For more details, refer to [Bucket Access Control](BOS/API Reference/Access control.md#Bucket permission control).
How to verify whether an object/a bucket exists or not?
BOS supports [GetObjectMeta](BOS/API Reference/Object-Related Interface/Basic Operations/GetObjectMeta.md) and [HeadBucket](BOS/API Reference/Bucket-Related Interface/Basic Operations/HeadBucket.md) APIs. You can use these two APIs to verify whether an object/a bucket exists or not.
How to mount BOS to linux server?
BOS can be attached to a Linux system BCC server using BOSFS (attaching is not currently supported on Windows systems).BOSFS is used to mount remote BOS services to the local file system, achieving functionality similar to that of a network file system. Its purpose is to facilitate users in accessing files on BOS using system commands or standard POSIX API, just as conveniently as using a local disk. In case of any problem during the configuration, you are recommended to submit Ticket for processing.
How to integrate BOS into APP?
BOS iOS and Android SDK have no limitations on integration. If it is normal to use demo but an error for integration is reported, it is preferred that you integrate it as demo, or integrate the project into the demo project. If it is abnormal to use demo, you are recommended to submit Ticket for processing.
What are the requirements for the version of phpunit when the sample code of PHP SDK is running?
The phpunit version must be 4.5.0 or higher.
How to use BOS to build FTP service?
BOS is unable to be used as FTP directly, but you can use Peripheral Tool for download and upload to simulate FTP. Or you can call API and SDK for development by yourself, or refer to the Python-based BOS FTP server tool: BOSFTP.
How to connect UCenter and Python flask to BOS?
If you have built Wordpress, Discuz, UCenter and Python flask and want to use them in conjunction with BOS service, you are recommended to install corresponding plugin to solve the occupation of local disks on the one hand, and improve the browsing speed for the pictures and other multi-media on the other hand. For specific usage, refer to [Third-party Tools](BOS/Peripheral Tools/Third-party tools/Other Tools.md).
How to specify file path and file name when uploading via InputStream in Java SDK?
To specify the path and name of a file using the inputStream method in the Java SDK, simply provide the file path and name as a parameter and write out the full path for that parameter.
For example: If the local file path is a/b/c/1.txt, the corresponding structure for the file in BOS will be: directory: a/b/c/; filename: 1.txt.
Does WeChat has a direct upload API?
There is currently no cases of uploading from WeChat to Baidu AI Cloud Object Storage (BOS). You can write using BOS's API. Reference: Baidu AI Cloud Object Storage (BOS) API Documentation, If the problem persists, please submit a Baidu AI Cloud Object Storage (BOS) Ticket.
How to obtain HTTPS resource URLs using the BOS Java SDK?
You can set the endpoint in the Java SDK to HTTPS, then call the generatePresignedUrl API to obtain HTTPS URLs. For details, refer to: Configure HTTPS for BOS Access.
Can the Baidu Storage Gateway specify a BOS bucket across accounts?
Supported. BOS allows mounting multiple buckets on a single server without restrictions, and BSG supports creating different shared directories. Each shared directory can be associated with specific AK, SK, and buckets from different accounts.
How to exclude folders in bcecmd?
BOS CMD provides the --exclude Parameter to exclude specified directories during resource upload.For example, the command bcecmd bos sync ./sample/ bos:/bce-test/test --exclude "./sample/app01" migrates and backs up data from the local sample directory (excluding the app01 subdirectory) to BOS.
