GetSymlink

Updated at:

To obtain a symbolic link by calling GetSymlink operations, you must have the read permission on the symbolic link.

Versioning

GetSymlink obtains the current version of the target symbol link by default. You can specify the versionId in the request to obtain the specified version of a symbol link. If the current version of the target symbol link is a delete marker, OSS returns the 404 Not Found error and includes x-oss-delete-marker = true and x-oss-version-id in the response header. A delete marker does not contain any data. Therefore, the information about the target object that the symbol link directs to is not included in the response.

Syntax

GET /ObjectName?symlink HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
Authorization: SignatureValue

When you call this operation in OSS on Cloud Box, you need to replace the Host with the CloudBox endpoints. For more information, see CloudBox endpoints.

Request headers

All headers in a GetSymlink request are common request headers. For more information, see Common request headers.

Response headers

Header

Type

Example

Description

x-oss-symlink-target

String

example.jpg

Indicates the target object that the symbol link directs to.

Examples

  • Normal request example:

    GET /link-to-oss.jpg?symlink HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Fri, 24 Feb 2012 06:38:30 GMT
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Response example:

    HTTP/1.1 200 OK
    Server: AliyunOSS
    Date: Fri, 24 Feb 2012 06:38:30 GMT
    Last-Modified: Fri, 24 Feb 2012 06:07:48 GMT
    Content-Length: 0
    Connection: keep-alive
    x-oss-request-id: 5650BD72207FB30443962F9A
    x-oss-symlink-target: example.jpg
    ETag: "A797938C31D59EDD08D86188F6D5****"
  • Example of a request initiated with a specified versionId to obtain the specified version of a symbol link:

    GET /link-to-oss.jpg?symlink&versionId=CAEQNRiBgMClj7qD0BYiIDQ5Y2QyMjc3NGZkODRlMTU5M2VkY2U3MWRiNGRh**** HTTP/1.1
    Host: oss-example.oss-cn-hangzhou.aliyuncs.com
    Date: Tue, 09 Apr 2019 06:50:48 GMT
    Authorization: OSS4-HMAC-SHA256 Credential=LTAI********************/20250417/cn-hangzhou/oss/aliyun_v4_request,Signature=a7c3554c729d71929e0b84489addee6b2e8d5cb48595adfc51868c299c0c218e

    Response example:

    HTTP/1.1 200 OK
    Server: AliyunOSS
    Date: Tue, 09 Apr 2019 06:50:48 GMT
    Last-Modified: Tue, 09 Apr 2019 06:50:48 GMT
    Content-Length: 0
    Connection: keep-alive
    x-oss-version-id: CAEQNRiBgMClj7qD0BYiIDQ5Y2QyMjc3NGZkODRlMTU5M2VkY2U3MWRiNGRh****
    x-oss-request-id: 5CAC40C8B7AEADE01700064D
    x-oss-symlink-target: example.jpg
    ETag: "40CF4D450730DCCD1A78566FAE35****"

OSS SDKs

You can use OSS SDKs for the following programming languages to call GetSymlink operation:

ossutil

For information about the ossutil command that corresponds to the GetSymlink operation, see get-symlink.

Error codes

Error code

HTTP status code

Description

NoSuchKey

404

The requested object does not exist.

NotSymlink

400

The requested symbol link does not exist.