Baidu AI Cloud
中国站

百度智能云

Object Storage

FetchObject

Interface Description

This interface is used to fetch resources from the specified URL and store them in the specified bucket. This operation requires the requester to have the write permission of this bucket. Only one object can be fetched each time. The user can customize the object name.

Notes:

  • The size of resources fetched by the FetchObject interface is limited to 0-10 GB.

Request

  • Request syntax

    POST /<ObjectName>?fetch HTTP/1.1
    Host: <BucketName>.bj.bcebos.com
    Content-Length: 0
    Date: <Date>
    x-bce-fetch-source: <Source>
    x-bce-fetch-mode: <FetchMode>
    x-bce-storage-class: <StorageClass>
    Authorization: AuthorizationString
  • Request header field

    Name Type Description Required?
    x-bce-fetch-source String Source address of the fetched file, e.g., http://www.abc.com/img.jpg. This parameter can be put into the querystring. When it is put into the querystring, the UrlEncode is required. Yes
    x-bce-fetch-mode String Fetch mode, which includes async and sync fetch modes. In the asynchronous fetch mode, BOS returns “Fetched successfully” immediately after it receives the fetch task. In the synchronous fetch mode, BOS does not return “Fetched successfully” before it fetches the object successfully. It is recommended to use the synchronous fetch mode for a small amount of data or real-time fetch results. It does not need to wait in the asynchronous fetch mode, which is suitable for the scenarios where it is not necessary to view the fetch results real time. You can query the fetch results subsequently. The default value is sync. This parameter can be put into the querystring. No
    x-bce-storage-class String Storage type, which can be standard storage STANDARD, infrequent access STANDARD_IA, cold storage COLD, and archive storage ARCHIVE. The default storage is STANDARD. If it is a multi-AZ bucket, MAZ_STANDARD_IA represents the multi-AZ infrequent access. If it is not specified, it is multi-AZ MAZ_STANDARD by default and cannot be other values. This parameter can be put into the querystring. No
    x-bce-server-side-encryption String Server encryption algorithm, only AES256 is supported currently. No
  • Request parameters

    None

Response

  • Response header field

    None

  • Response parameters

    Name Type Description
    code String It returns the code for the request success or failure. If the request is successful, it returns success. In case of an error, it returns the Error Code.
    message String It returns the message on request success or failure. If the request is successful, return success. In case of an error, return the Error Code corresponding to the return code.
    requestId String Request ID.
    jobId String It returns this parameter in the asynchronous mode only, which indicates the ID number of the request task. You can use it for subsequent task status query.

Example

  • Request example (synchronous mode)

    POST /ObjectName?fetch HTTP/1.1
    Host: BucketName.bj.bcebos.com
    Content-Length: 0
    Date: <Date>
    x-bce-fetch-source: http://www.abc.com/demo.html
    x-bce-fetch-mode: sync
    x-bce-storage-class: STANDARD
    Authorization: AuthorizationString
  • Response example (synchronous mode)

    HTTP/1.1 200 OK
    x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409
    Transfer-Encoding: chunked
    Date: Wed, 25 May 2016 06:34:40 GMT
    Server: BceBos
    
    {
        "code": "success",
        "message": "success",
        "requestId": "4db2b34d-654d-4d8a-b49b-3049ca786409",
    }
  • Request example (asynchronous mode)

    POST /ObjectName?fetch HTTP/1.1
    Host: BucketName.bj.bcebos.com
    Content-Length: 0
    Date: <Date>
    x-bce-fetch-source: http://www.abc.com/demo.html
    x-bce-fetch-mode: async
    x-bce-storage-class: STANDARD_IA
    Authorization: AuthorizationString
  • Response example (asynchronous mode)

    HTTP/1.1 200 OK
    x-bce-request-id: 4db2b34d-654d-4d8a-b49b-3049ca786409
    Content-Length: 43
    Date: Wed, 25 May 2016 06:34:40 GMT
    Server: BceBos
    
    {
        "code": "success",
        "message": "success",
        "requestId": "4db2b34d-654d-4d8a-b49b-3049ca786409",
        "jobId": "b2419b1e3fd45d596ee22bdf62aaaa2f"
    }
Previous
DeleteObject
Next
GetObject