Publishes an API.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes PublishDataServiceApi

The operation that you want to perform. Set the value to PublishDataServiceApi.

RegionId String Yes cn-shanghai

The region ID. For example, the ID of the China (Shanghai) region is cn-shanghai, and that of the China (Zhangjiakou) region is cn-zhangjiakou. The system determines the value of this parameter based on the endpoint that is used to call the operation.

TenantId Long Yes 10002

The ID of the tenant.

ProjectId Long Yes 10001

The ID of the DataWorks workspace. You can log on to the DataWorks console and go to the Workspace Management page to obtain the workspace ID.

ApiId Long Yes 10000

The ID of the API. You can call the ListDataServiceApis operation to obtain the ID.

Response parameters

Parameter Type Example Description
HttpStatusCode Integer 200

The HTTP status code.

Data Boolean true

Indicates whether the API is published.

ErrorMessage String The connection does not exist.

The error message.

RequestId String 0000-ABCD-EFG****

The ID of the request.

ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code.

Success Boolean true

Indicates whether the request is successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=PublishDataServiceApi
&TenantId=10002
&ProjectId=10001
&ApiId=10000
&<Common request parameters>

Sample responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<PublishDataServiceApiResponse>
    <HttpStatusCode>200</HttpStatusCode>
    <Data>true</Data>
    <ErrorMessage>The connection does not exist.</ErrorMessage>
    <RequestId>0000-ABCD-EFG****</RequestId>
    <ErrorCode>Invalid.Tenant.ConnectionNotExists</ErrorCode>
    <Success>true</Success>
</PublishDataServiceApiResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "HttpStatusCode" : 200,
  "Data" : true,
  "ErrorMessage" : "The connection does not exist.",
  "RequestId" : "0000-ABCD-EFG****",
  "ErrorCode" : "Invalid.Tenant.ConnectionNotExists",
  "Success" : true
}

Error codes

For a list of error codes, visit the API Error Center.