SetDataSourceShare

Updated at:

Shares a target data source with a specified DataWorks workspace or specified users.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

No authorization for this operation. If you encounter issues with this operation, contact technical support.

Request parameters

Parameter

Type

Required

Description

Example

ProjectId

integer

Yes

The ID of the DataWorks workspace to which the target data source belongs. You can call the ListProjects operation to obtain the workspace ID.

10000

DatasourceName

string

Yes

The name of the target data source to be shared.

mysql_name

EnvType

string

No

The environment to which the target data source belongs. Valid values:

  • 0: development environment.

  • 1: production environment.

1

ProjectPermissions

string

No

The DataWorks workspace with which you want to share the target data source. After the data source is shared, all members of the workspace can view or use the target data source. Use the JSON array format. Example: [{"projectId":1000,"permission":"WRITE","sharedName":"PX_DATAHUB1.shared_name"}]. Parameter description:

  • projectId: the ID of the workspace with which you want to share the target data source.

  • permission: the permission mode. Valid values: READ and WRITE. READ indicates that all members of the specified workspace can only read data from the target data source but cannot modify the data. WRITE indicates that all members of the specified workspace can modify data in the target data source.

  • sharedName: the name of the data source to be shared.

[{"projectId":1000,"permission":"WRITE","sharedName":"PX_DATAHUB1.shared_name"}]

UserPermissions

string

No

The users with whom you want to share the target data source. After the data source is shared, the specified users can view or use the target data source. Use the JSON array format. Example: [{"projectId":10000,"users":[{"userId":"276184575345452131","permission":"WRITE"}],"sharedName":"PX_DATAHUB1.shared_name"}]. Parameter description:

  • projectId: the ID of the DataWorks workspace. This indicates that the users with whom you want to share the target data source can view or use the target data source only in this workspace.

  • userId: the ID of the user with whom you want to share the target data source.

  • permission: the permission mode. Valid values: READ and WRITE. READ indicates that the specified user can only read data from the target data source but cannot modify the data. WRITE indicates that the specified user can modify data in the target data source.

  • sharedName: the name of the data source to be shared.

If both ProjectPermissions and UserPermissions are empty, this operation does not make any modifications. If neither is empty, both UserPermissions and ProjectPermissions take effect.

[{"projectId":10000,"users":[{"userId":"276184575345452131","permission":"WRITE"}],"sharedName":"PX_DATAHUB1.shared_name"}]

Response elements

Element

Type

Description

Example

object

Success

boolean

Indicates whether the request was successful. Valid values:

  • true: The request was successful.

  • false: The request failed.

true

RequestId

string

The unique ID of the request. You can use the ID to locate logs and troubleshoot issues when an error occurs.

0000-ABCD-EFG

Data

object

The returned data for sharing the target data source.

Status

string

The result status of sharing the target data source. Valid values:

  • success: The target data source was shared.

  • fail: The target data source failed to be shared. You can check the Message parameter to locate the cause of the failure.

success

Message

string

The description of the cause for the failure to share the target data source. If the target data source is shared, the value of this parameter is empty.

datasource is wrong

Examples

Success response

JSON format

{
  "Success": true,
  "RequestId": "0000-ABCD-EFG\t",
  "Data": {
    "Status": "success",
    "Message": "datasource is wrong"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 Invalid.DI.Parameter The parameter is invalid. The parameter is invalid.
500 InternalError.DI.Parameter A DI internal error occurred. A Data Integration internal business error occurred.
403 Forbidden.DI.NoPrivilege No access. Access denied.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.