Updated on 2024-09-12 GMT+08:00

Creating a Synchronization Event

Function

This API is used to create a synchronization event when objects in the source bucket need to be synchronized. Then OMS synchronizes the objects contained in the synchronization event. This API is available in regions CN North-Beijing4 and CN East-Shanghai1.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/sync-tasks/{sync_task_id}/events

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

Minimum length: 1 character

Maximum length: 1,024 characters

sync_task_id

Yes

String

The synchronization task ID.

Minimum length: 1 character

Maximum length: 1,024 characters

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The token used for API authentication. It is recommended that you use signature authorization. For details, see "API Authentication."

Minimum length: 1 character

Maximum length: 16,384 characters

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

object_keys

Yes

Array of strings

The list of URL-encoded names of objects to be synchronized. A maximum of 10 objects can be included.

Minimum length: 1 character

Maximum length: 16,384 characters

Array length: 1 to 100

Response

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Status code: 404

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Status code: 503

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Example Request

  • This example creates a synchronization event for the task 31e9b7e6-6ffb-452f-9842-6ce354d99d75 to synchronize the files test %2F001.txt and test %2F002.txt.

    /v2/f697f813-554a-4f05-bac8-82a183b20878/sync-tasks/31e9b7e6-6ffb-452f-9842-6ce354d99d75/events
    
    {
      "object_keys" : [ "test%2F001.txt", "test%2F002.txt" ]
    }
  • This example creates a synchronization event for the task 31e9b7e6-6ffb-452f-9842-6ce354d99d75 to synchronize the file test %2B001.txt.

    /v2/f697f813-554a-4f05-bac8-82a183b20878/sync-tasks/31e9b7e6-6ffb-452f-9842-6ce354d99d75/events
    
    {
      "object_keys" : [ "test%2B001.txt" ]
    }
  • This example creates a synchronization event for the task 31e9b7e6-6ffb-452f-9842-6ce354d99d75 to synchronize the file test+001.txt.

    /v2/f697f813-554a-4f05-bac8-82a183b20878/sync-tasks/31e9b7e6-6ffb-452f-9842-6ce354d99d75/events
    
    {
      "object_keys" : [ "test+001.txt" ]
    }

Example Response

None

Status Codes

Status Code

Description

200

OK. Synchronous event created successfully.

400

Bad request. Invalid parameters.

404

Not found. Synchronization task not found.

503

Service unavailable. Please try again later.

Error Codes

For details, see Error Codes.