Accept data subscription¶
Accepts a data subscription and specifies the subscription database name in the target workspace.
POST $CLOUDSIGMA_API_BASE/data-share/subscriptions/{id}/subscribe
Before you call this API¶
Configure the regional API endpoint and authentication, and select the target workspace.
First query the data subscription list to confirm the subscription to be accepted.
Set the operation-specific values used in the request:
$SUBSCRIPTION_ID: The subscription ID to be accepted, taken from the response of query data subscription list.
Request¶
curl -X POST "$CLOUDSIGMA_API_BASE/data-share/subscriptions/$SUBSCRIPTION_ID/subscribe" \
-H "X-API-Key: $CLOUDSIGMA_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
-d '{
"sub_name": "sales_subscription"
}'
Path parameters
Parameters |
Type |
Description |
|---|---|---|
|
integer |
A subscription ID greater than |
Request body
Field |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Local subscription name. |
Successful response¶
Returns 200 and the updated subscription record on success. Record the target database ID; it represents the subscription database created in the target workspace.
{
"code": "OK",
"msg": "OK",
"data": {
"id": "201",
"pub_name": "sales-share",
"source_database_id": "101",
"mo_database_name": "sales",
"table_scope": {
"mode": "selected",
"object_ids": ["1001"]
},
"target_database_id": "301",
"obj_display_name": "sales",
"obj_display_path": "catalog/sales",
"source_workspace_id": "ws-001",
"source_workspace_name": "数据工作区",
"publisher": "user-001",
"published_at": "2026-08-18T10:00:00Z",
"status": "subscribed",
"sub_name": "sales_subscription",
"subscribed_by": "user-002",
"created_at": "2026-08-18T10:00:00Z"
}
}
The response fields are as follows.
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
|
|
string |
Subscription ID. |
|
string |
Source publication name. |
|
string |
Source database ID. |
|
string |
Source database name. |
|
object |
Publish shared table range. |
|
string |
Range mode: |
|
string[] |
List of table IDs when the range mode is |
|
string |
ID of the subscription database in the target workspace; returned after successful acceptance. |
|
string |
The display name of the source database. |
|
string |
The display path of the source database. |
|
string |
Source workspace ID. |
|
string |
Source workspace name; returned if there is a value. |
|
string |
Publisher. |
|
string |
Release time. |
|
string |
Current subscription status. |
|
string |
The name of the subscription database in the target workspace. |
|
string |
The identity to accept the subscription. |
|
string |
Time to accept subscription. |
[] after a type means an array. For example, string[] is an array of strings.
Error response¶
{
"code": "ErrAlreadySubscribed",
"msg": "数据已订阅",
"data": null
}
Common HTTP errors¶
HTTP status code |
error code |
Common causes |
Recommended actions |
|---|---|---|---|
|
|
Invalid subscription ID or |
Check the path and request body fields. |
|
|
The current identity does not have permission to create subscriptions. |
Request permission to create data subscriptions. |
|
|
The subscription does not exist or does not belong to the current workspace. |
Verify subscription ID and workspace. |
|
|
The subscription has been accepted. |
Query the subscription list to avoid repeated submissions. |
|
|
The target workspace already has a subscription database with the same name. |
Replace |
|
|
Dependent services are temporarily unavailable. |
Try again later. |
|
|
The server failed to accept the subscription. |
Try again later. |
Follow-up operations¶
Use data.target_database_id to record the target subscription database; then Query data subscription list to confirm the subscription status and name.