Create data publication

Publish all tables or specified tables in the source database to the target workspace. Successful creation only means that the publication has been established, but does not mean that the target workspace has accepted the subscription.

HTTP
POST $CLOUDSIGMA_API_BASE/data-share/publishes

Before you call

Configure the CloudSigma regional endpoint and authentication before calling. The endpoint, credentials, workspace, and resource IDs must belong to the same region. Prepare the personal access token, source workspace ID, source database ID, and target workspace ID that have access rights to the source workspace.

Request body

Shell
curl -X POST "$CLOUDSIGMA_API_BASE/data-share/publishes" \
  -H "X-API-Key: $CLOUDSIGMA_API_KEY" \
  -H "X-Workspace-ID: $WORKSPACE_ID" \
  -H 'Content-Type: application/json' \
  --data-binary @- <<JSON
{
  "name": "sales-share",
  "source_database_id": "${SOURCE_DATABASE_ID}",
  "table_scope": {
    "mode": "selected",
    "object_ids": ["${TABLE_ID}"]
  },
  "target_workspace_ids": ["${TARGET_WORKSPACE_ID}"],
  "remark": "共享销售数据"
}
JSON

The source list supports uint64 table IDs, but only numeric table IDs in the int64 range are recognized when creating a publication. Values ​​exceeding this range will be processed according to the table name, and the wrong table may be selected.

table_scope can be omitted or filled in with null. When selecting all, the table ID list is ignored.

When selecting selected, fill in a non-empty table list. Omitting the list or filling in null or [] will be treated as the entire table. This interface does not have a fixed cap on the 1000 entry. Don’t use different source targeting methods at the same time.

Field

Type

Required

Description

name

string

Yes

Publication name. It must be nonempty, contain at most 200 characters, and contain no spaces, tabs, backticks, single quotes, or double quotes.

source_database_id

string

No

Source database ID, supplied as a string containing a positive integer.

table_scope

object or null

No

Table scope configuration. See the current limitations below for the behavior when omitted or null.

table_scope.mode

string

Yes

Scope: all or selected. all publishes all current tables in the source database; selected publishes only the tables specified in object_ids.

table_scope.object_ids

array or null

No

Physical table IDs used for selected scope. Empty values may be treated as all tables; see the current limitations.

obj_id

string

No

Association ID.

obj_name

string

No

Display information.

obj_type

string

No

Compatible object types. The value is empty string, db.

obj_path

string

No

Compatible object paths.

tables

array or null

No

List of compatible table names.

target_workspace_ids

array of string

Yes

At least one unique target workspace ID. It cannot contain the current workspace ID, and each value cannot have leading or trailing blanks.

remark

string

No

Remarks.

table_scope.object_ids

array of string

No

List of table IDs used by selected. When omitting or filling in null or [], it will also be treated as the entire table. all mode ignores this value.

Successful response

JSON
{
  "code": "OK",
  "msg": "OK",
  "data": {
    "id": "101",
    "name": "sales-share",
    "obj_display_name": "sales",
    "obj_display_path": "catalog/sales",
    "targets": [
      {
        "workspace_id": "ws-002",
        "workspace_name": "分析工作区"
      }
    ],
    "permission": "readonly",
    "remark": "共享销售数据",
    "created_by": "user-001",
    "created_at": "2026-08-18T10:00:00Z",
    "updated_at": "2026-08-18T10:00:00Z",
    "source_database_id": "1001",
    "mo_database_name": "sales",
    "table_scope": {
      "mode": "selected",
      "object_ids": [
        "2001"
      ]
    }
  }
}

Field

Type

Description

code

string

success code.

msg

string

Response information.

data

object

The data returned by this operation.

data.id

string

Release ID.

data.name

string

Release name.

data.obj_display_name

string

Source object name for display.

data.obj_display_path

string

Source object path for display.

data.targets

array of object

Target workspace list.

data.targets[].workspace_id

string

Target workspace ID.

data.targets[].workspace_name

string

Target workspace name.

data.permission

string

Fixed to readonly

data.remark

string

Post notes.

data.created_by

string

Creator ID.

data.created_at

string

Creation time.

data.updated_at

string

Last updated.

data.source_database_id

string

Source database ID.

data.mo_database_name

string

Source database name in OmniFabric.

data.table_scope

object

Published table range.

data.table_scope.mode

string

Table range mode. The values are all, selected

data.table_scope.object_ids

array of string or null

List of table IDs within publication scope. The entire table range may be null, and this cannot be used to determine that the table has not been published.

Error response

Publishing requires data publishing permissions and access to source data. Publishing involves database, cross-workspace invitation and ownership registration, and some changes may have been completed after failure.

HTTP 409 may require manual repair, and HTTP 503 may indicate that a dependency is unavailable. Keep the request and tracking identifiers, query the publishing results first, and then decide whether to try again.

JSON
{
  "code": "ErrDuplicatePublish",
  "msg": "发布已存在",
  "data": null
}

Field

Type

Description

code

string

error code.

msg

string

Error description.

data

null

Empty on error.

Common HTTP errors

HTTP status

Error code

Common cause

Recommended action

400

ErrWorkspaceRequired, ErrParamInvalid

Invalid request field, workspace, or operation precondition.

Fix the request parameters and submit again.

403

ErrPermissionDenied

The current identity or active role does not have permission for this operation.

Use an authorized identity or contact an administrator to grant access.

404

ErrSourceNotFound, ErrPublishNotFound, ErrSubscriptionNotFound

The target object or required reference was not found.

Verify the object identifier, workspace, and current status.

409

ErrDuplicateName, ErrDuplicatePublish, ErrSubscriptionOfferExpired, ErrAlreadySubscribed, ErrNameConflict, ErrPublicationTargetNotFound, ErrDataShareMutationInProgress, ErrDataShareRepairRequired, ErrDataShareManualRecoveryRequired, ErrConcurrentUpdate

Conflict in resource state, request payload, or concurrent modification.

Re-read the current state and version, then handle according to the latest result.

500

ErrServer

Internal processing failed; write operations may have been partially applied.

Retain request and trace details, and verify the current state before retrying.

503

ErrServiceUnavailable, ErrPublicationCreateRetryable

A business, runtime, or authorization dependency is temporarily unavailable.

After the dependency recovers, check existing results first instead of blindly repeating writes.

Last updated on