Baidu AI Cloud
中国站

百度智能云

Object Storage

PutSymlink

Interface Description

With the PutSymlink interface, yo can create the soft link (Symlink) for the existing destination object in the same bucket of BOS. You can access the destination object through this soft link.

Notes:

  • The soft link file and destination object file need to be located in the same bucket.
  • At present, you can set the soft link for object files of the standard storage, infrequent access, cold storage, and archive storage. The soft link file itself does not support the archive type. If the user specifies the archive type or does not specify the storage type and the default storage type of the bucket is archive type, it returns “CODE_INVALID_ARGUMENT”.
  • When you call this interface to create the soft link, the system does not check whether the destination file exists. Also, you have permission to access the destination file. When you call the GetObject interface using the soft link, check whether the user has the read permission of the soft link and destination file and the destination file exists.
  • To create the soft link, you must have the corresponding write permission.
  • If the header "x-bce-forbid-overwrite" is not specified and there is an object file with the same name as the soft link file, the object with the same name is overwritten by default during the creation of the soft link.
  • It does not support the secondary soft link. No check is done when the user creates the secondary soft link. However, the user cannot access the object data pointed to through the secondary soft link.

Request

  • Request syntax

PUT /<ObjectName>?symlink HTTP/1.1
Host: <BucketName>.bj.bcebos.com
Date: <Date>
Authorization: <AuthorizationString>
x-bce-symlink-target: <TargetObjectName>
x-bce-forbid-overwrite: false
  • Request parameters

    No special parameters.

  • Request header field

Name Type Description Required?
x-bce-symlink-target String It specifies the destination file of the soft link. The naming convention is the same as the object. The destination file of the soft link cannot be the soft link file. Yes
x-bce-forbid-overwrite String It specifies whether the object with the same name is overwritten during the creation of the soft link. If x-bce-forbid-overwrite is not specified, the object with the same name is overwritten by default. When x-bce-forbid-overwrite is specified as true, it indicates that overwriting the object with the same name is prohibited. When x-bce-forbid-overwrite is specified as false, it indicates that overwriting the object with the same name is allowed. No
x-bce-meta-* String User-defined meta No
x-bce-storage-class String It specifies the storage type of the soft link file. STANDARD represents the standard storage, STANDARD_IA represents the infrequent access, and COLD represents the cold storage. If it is not specified, it is the bucket storage by default. The soft link file itself does not support the archive type. No

Response

  • Response header field

Name Type Description
ETag String HTTP protocol entity tag of the destination object name for the soft link
  • Response element

No special element

Example

  • Request example

PUT /<ObjectName>?symlink HTTP/1.1
Host: <BucketName>.bj.bcebos.com
Date: <Date>
Authorization: <AuthorizationString>
x-bce-symlink-target: <TargetObjectName>
x-bce-forbid-overwrite: false
  • Response example

HTTP/1.1 200 OK
x-bce-request-id: 4db4b34d-653d-4d9a-b49b-3049ca786409
Date: Wed, 31 May 2018 08:34:40 GMT
ETag: "1b2cf535f27731c974343645a3985328"
Server: BceBos
Previous
GetSymlink
Next
SDK