Updated on 2026-04-16 GMT+08:00

Modifying an Object

Functions

This operation can modify an object from a specified position.

This API is supported only by parallel file systems. For details about how to create a parallel file system, see Sample Request: Creating a Parallel File System.

Authorization Information

To call this API, you must be the object owner or have the permission to modify an object. You are advised to use IAM or bucket policies for authorization. For details about OBS authorization methods, see Differences Between OBS Permissions Control Methods.

  • If you use IAM for authorization, you need to use either role/policy-based authorization or identity policy-based authorization and configure the required permissions:
    • If you use role/policy-based authorization (IAM v3 APIs in the old IAM version), you need to grant the obs:object:PutObject permission. For details, see Creating a Custom IAM Policy.
    • If you use identity policy-based authorization (IAM v5 APIs in the new IAM version), you need to grant the obs:object:putObject permission, as shown in the following table. For details, see Creating a Custom IAM Identity Policy.

      Action

      Access Level

      Resource Type (*: Required)

      Condition Key

      Alias

      Dependencies

      obs:object:putObject

      Permission_management

      object *

      g:EnterpriseProjectId

      -

      • kms:cmk:create
      • kms:cmk:list
      • kms:cmk:createDataKey
      • functiongraph:function:invokeAsync
      • functiongraph:workflow:invoke
      • smn:topic:publish

      -

      • obs:EpochTime
      • obs:SourceIp
      • obs:TlsVersion
      • obs:CustomDomain
      • obs:x-obs-acl
  • If you use bucket policies for authorization, you need to grant the obs:object:putObject permission. For details, see Creating a Custom Bucket Policy.

Request Syntax

PUT /ObjectName?modify&position=Position HTTP/1.1
Host: bucketname.obs.region.myhuaweicloud.com 
Content-Type: type
Content-Length: length
Authorization: authorization
Date: date
<object Content>

URI Parameters

The request needs to specify parameters in the message, indicating that the upload is for modification, and specifying the position in the object to be modified. Table 1 describes the parameters.

Table 1 URI parameters

Parameter

Mandatory (Yes/No)

Type

Description

modify

Yes

String

Definition:

If this parameter is carried, the request uploads data by modifying the object.

Constraints:

None

Range:

None

Default value:

None

position

Yes

Integer

Definition:

The position where the object is modified (counting from the first character). Unit: byte.

Constraints:

None

Range:

The value is an integer greater than or equal to 0, and the length of the file after the modification cannot exceed 54975581388800 (50 TB).

Default value:

None

Request Headers

This request uses common headers. For details, see Table 3.

Request Body

This request contains no request body parameters.

Response Syntax

1
2
3
4
5
6
7
HTTP/1.1 status_code
Date: Date
ETag: etag
Content-Length: length
Server: OBS
x-obs-request-id: request-id
x-obs-id-2: id

Response Headers

This response uses common headers. For details, see Table 1.

Response Body

This response contains no elements.

Error Responses

No special error responses are returned. For details about error responses, see Table 2.

Sample Request

PUT /ObjectName?modify&position=Position HTTP/1.1
Host: examplebucket.obs.region.myhuaweicloud.com
Date: Wed, 08 Jul 2015 06:57:01 GMT
Content-Type: image/jpg
Content-Length: 1458
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:kZoYNv66bsmc10+dcGKw5x2PRrk=

[1458 bytes of object data]

Sample Response

1
2
3
4
5
6
7
HTTP/1.1 200
Date: Wed, 08 Jul 2015 06:57:02 GMT
ETag: "d41d8cd98f00b204e9800998ecf8427e"
Content-Length: 0
Server: OBS
x-obs-request-id: 8DF400000163D3F0FD2A03D2D30B0542
x-obs-id-2: 32AAAUgAIAABAAAQAAEAABAAAQAAEAABCTjCqTmsA1XRpIrmrJdvcEWvZyjbztd

Using SDKs to Call APIs

You are advised to use OBS SDKs to call APIs. SDKs encapsulate APIs to simplify development. You can call SDK API functions to access OBS without manually calculating signatures.

Java

Python: not supported

C

Go

BrowserJS: not supported

.NET: not supported

Android: not supported

iOS: not supported

PHP: not supported

Node.js: not supported

Harmony: not supported

Helpful Links

For details about the billing items involved in API operations, see Billing Items.