Updates the information about an API in the development state in DataService Studio.

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 UpdateDataServiceApi

The operation that you want to perform.

ApiDescription String Yes Test API description

The description of the API operation.

ApiId Long Yes 10000

The ID of the API to query.

ApiPath String Yes /test/2

The path to the API.

ProjectId Long Yes 10001

The ID of the DataWorks workspace.

Protocols String Yes 0,1

The protocol used by the API. You can select 0(HTTP) and 1(HTTPS) for enumeration. Multiple values are supported, and multiple values are separated by a comma (,).

RegionId String Yes cn-shanghai

The ID of the region where your project resides.

RequestMethod Integer Yes 0

The API request method. You can select 0(GET), 1(POST), 2(PUT), or 3(DELTE). The Wizard and script APIs support GET and POST. The registration API supports GET, POST, PUT, and DELETE.

ResponseContentType Integer Yes 0

The type of the data to be returned for the API. Valid values: 0(JSON) and 1(XML). JSON is supported for Wizard and script APIs, and JSON and XML are supported for registration APIs.

TenantId Long Yes 10001

The ID of the tenant.

Timeout Integer Yes 10000

The timeout period. Unit: milliseconds. Valid values:

(0, 30000]. )
VisibleRange Integer Yes 0

Visible range. Optional enumeration values include 0 (workspace) and 1 (private).

WizardDetails String No {"isPagedResponse":true,"wizardConnection":{"connectionId":122786,"tableName":"person"},"wizardRequestParameters":[{"columnName":"id","defaultValue":"","exampleValue":"1","isRequiredParameter":true,"parameterDataType":2,"parameterDescription":"","parameterName":"id","parameterOperator":0,"parameterPosition":0}],"wizardResponseParameters":[{"columnName":"id","exampleValue":"11","parameterDataType":2,"parameterDescription":"","parameterName":"id"}]}

For more information about the codeless API, see GetDataServiceApi JSON String for the interface wizardDetails field.

ScriptDetails String No {"isPagedResponse":false,"script":"select id as id1, name as name1 from person where id=${inputid}","scriptConnection":{"connectionId":122786,"tableName":"person"},"scriptRequestParameters":[{"defaultValue":"","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"inputid","parameterOperator":0,"parameterPosition":1}],"scriptResponseParameters":[{"exampleValue":"","parameterDataType":0,"parameterDescription":"","parameterName":"id1"},{"exampleValue":"","parameterDataType":0,"parameterDescription":"","parameterName":"name1"}]}

For more information about the script API, see GetDataServiceApi The JSON String for the interface scriptDetails field.

RegistrationDetails String No {"failedResultSample":"fail","registrationErrorCodes":[{"errorCode":"e1","errorMessage":"msg1","errorSolution":"sol1"},{"errorCode":"e2","errorMessage":"msg2","errorSolution":"sol2"}],"registrationRequestParameters":[{"columnName":"","defaultValue":"","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"id","parameterOperator":0,"parameterPosition":1},{"columnName":"","defaultValue":"xx","exampleValue":"","isRequiredParameter":true,"parameterDataType":0,"parameterDescription":"","parameterName":"cc","parameterOperator":2,"parameterPosition":2}],"serviceContentType":1,"serviceHost":"http://www.baidu.com","servicePath":"/[uid]","serviceRequestBodyDescription":"body","successfulResultSample":"success"}

For more information about how to register APIs, see GetDataServiceApi The JSON String that contains the registrationDetails fields.

Response parameters

Parameter Type Example Description
Data Boolean true

Indicates whether the update operation was successful.

ErrorCode String Invalid.Tenant.ConnectionNotExists

The error code.

ErrorMessage String The connection does not exist.

The error message.

HttpStatusCode Integer 200

The HTTP status code.

RequestId String 0000-ABCD-EFG****

The unique ID of the request.

Success Boolean true

Indicates whether the request was successful.

Examples

Sample requests


     http(s)://[Endpoint]/? Action=UpdateDataServiceApi &ApiDescription=test API description&ApiId=10000 &ApiPath=/test/2 &ProjectId=10001 &Protocols=0,1 &RegionId=cn-shanghai &RequestMethod=0 &ResponseContentType=0 &TenantId=10001 &Timeout=10000&visibilange=0 &<common request parameters> 
   

Sample success responses

XML format


     <RequestId>0000-ABCD-EFG****</RequestId> <HttpStatusCode>200</HttpStatusCode> <Data>true</Data> <Success>true</Success> 
   

JSON Format


     { "RequestId": "0000-ABCD-EFG****", "HttpStatusCode": 200, "Data": true, "Success": true } 
   

Error codes

HttpCode Error codes Error message Description
403 Forbidden.Access Access is forbidden. Activate DataWorks first. You have restricted access. Please activate DataWorks Enterprise Edition or above.
500 InternalError.System An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
500 InternalError.UserId.Missing An internal system error occurred. Try again later. An internal system error occurred. Please try again later.
403 ResourceNotAuthorized.Api You are not authorized to access the resources. You cannot access resources without authorization.
429 Throttling.Api The request for this resource has exceeded your available limit. The request for the resource exceeds your available upper limit.
429 Throttling.System The DataWorks system is busy. Try again later. DataWorks the system is busy, please try again later.
429 Throttling.User Your request is too frequent. Try again later. Your request is too frequent, please try to slow down the request speed.

Go to the Error CenterFor more information, see error codes.