調用CreateDataServiceApi建立資料服務API。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| TenantId |
integer |
否 |
租戶 ID。 |
10001 |
| ProjectId |
integer |
是 |
工作空間的 ID。 |
10000 |
| ApiName |
string |
是 |
API 的名稱,支援漢字、英文、數字和底線(_),且只能以英文和漢字開頭,4~50 個字元。 |
Test API name |
| GroupId |
string |
是 |
商務程序的 ID。 |
Business process ID |
| ApiMode |
integer |
是 |
API 的類型,可選枚舉值包括 0(嚮導 API)、1(指令碼 API)和 2(註冊 API)。 |
0 |
| RequestMethod |
integer |
是 |
API 的請求方式,可選枚舉值包括 0(GET)、1(POST)、2(PUT)和 3(DELETE)。嚮導和指令碼 API 支援 GET 和 POST。註冊 API 支援 GET、POST、PUT 和 DELETE。 |
0 |
| ResponseContentType |
integer |
是 |
API 的返回資料類型,可選枚舉值包括 0(JSON)和 1(XML)。嚮導和指令碼 API 支援 JSON,註冊 API 支援 JSON 和 XML。 |
0 |
| Timeout |
integer |
是 |
逾時時間,單位為毫秒(ms),取值範圍為(0, 30000]。 |
10000 |
| VisibleRange |
integer |
是 |
可見範圍,可選枚舉值包括 0(工作空間)和 1(私人)。 |
0 |
| Protocols |
string |
是 |
API 的協議,可選枚舉值包括 0(HTTP)和 1(HTTPS)。支援多個值,多個值之間使用英文逗號(,)分隔。 |
0,1 |
| WizardDetails |
string |
否 |
嚮導 API 的詳情,請參見 GetDataServiceApi 介面 wizardDetails 欄位的 JSON String。 |
{"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"}]} |
| ScriptDetails |
string |
否 |
指令碼 API 的詳情,請參見 GetDataServiceApi 介面 scriptDetails 欄位的 JSON String。 |
{"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"}]} |
| RegistrationDetails |
string |
否 |
註冊 API 的詳情,請參見 GetDataServiceApi 介面 registrationDetails 欄位的 JSON String。 |
{"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"} |
| ApiPath |
string |
是 |
API 的路徑,支援英文、數字、底線(_)和連字號(-),且只能以斜線(/)開頭,不能超過 200 個字元。 |
/test/1 |
| ApiDescription |
string |
是 |
API 的描述資訊。 |
Test API description |
| FolderId |
integer |
否 |
建立 API 的目標檔案夾 ID,商務程序下根資料夾 ID 等於 0,使用者自建檔案夾 ID 大於 0。 |
0 |
| SqlMode |
integer |
否 |
|
0 |
| ResourceGroupId |
integer |
否 |
獨享資源群組 ID。 |
3242432423 |
| RequestContentType |
integer |
否 |
請求資料類型。
|
0 |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
|||
| HttpStatusCode |
integer |
HTTP 狀態代碼。 |
200 |
| Data |
integer |
建立的 API ID。 |
100003 |
| ErrorMessage |
string |
錯誤資訊。 |
The connection does not exist. |
| RequestId |
string |
請求 ID,一次請求的唯一標識。 |
0000-ABCD-EFG**** |
| ErrorCode |
string |
錯誤碼。 |
Invalid.Tenant.ConnectionNotExists |
| Success |
boolean |
調用是否成功。 |
true |
樣本
正常返回樣本
JSON格式
{
"HttpStatusCode": 200,
"Data": 100003,
"ErrorMessage": "The connection does not exist.",
"RequestId": "0000-ABCD-EFG****",
"ErrorCode": "Invalid.Tenant.ConnectionNotExists",
"Success": true
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 500 | InternalError.System | An internal system error occurred. Try again later. | |
| 500 | InternalError.UserId.Missing | An internal system error occurred. Try again later. | |
| 403 | Forbidden.Access | Access is forbidden. Please first activate DataWorks Enterprise Edition or Flagship Edition. | 沒有許可權,請授權 |
| 429 | Throttling.Api | The request for this resource has exceeded your available limit. | |
| 429 | Throttling.System | The DataWorks system is busy. Try again later. | |
| 429 | Throttling.User | Your request is too frequent. Try again later. |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。