建立Mock規則。
調試
您可以在OpenAPI Explorer中直接運行該介面,免去您計算簽名的困擾。運行成功後,OpenAPI Explorer可以自動產生SDK程式碼範例。
調試
授權資訊
|
操作 |
存取層級 |
資源類型 |
條件關鍵字 |
關聯操作 |
|
mse:AddMockRule |
*全部資源
|
無 | 無 |
請求參數
|
名稱 |
類型 |
必填 |
描述 |
樣本值 |
| Name |
string |
是 |
規則名稱。 |
agent-auto-test-sc |
| Region |
string |
是 |
地區 ID。 |
cn-hangzhou |
| Source |
string |
是 |
規則來源。 |
edasmsc |
| ProviderAppId |
string |
否 |
服務提供者應用 ID。 |
dcqtkuhnc4@66e5235415**** |
| ProviderAppName |
string |
否 |
服務提供者應用程式名稱。 |
demo-cartservice |
| ExtraJson |
string |
是 |
描述。 |
{} |
| ScMockItems |
string |
是 |
入參數,支援 JSON 格式。 |
[] |
| DubboMockItems |
string |
是 |
資源回收筒中的專案。 |
[] |
| ConsumerAppIds |
string |
是 |
使用者自訂應用 ID。 |
[{\"appName\":\"provide\",\"appId\":\"bst8l6o735@f6d8aaf6e56e67d\"}] |
| Enable |
boolean |
否 |
警示規則的啟用狀態。取值:
|
true |
| MockType |
integer |
否 |
慢調用 RT。取值如下:
|
1 |
| AcceptLanguage |
string |
否 |
返回資訊的語言類型:
|
zh |
返回參數
|
名稱 |
類型 |
描述 |
樣本值 |
|
object |
資料結構。 |
||
| HttpStatusCode |
integer |
HTTP 狀態代碼。 |
200 |
| Message |
string |
返回資訊。 |
Succ |
| RequestId |
string |
請求 ID。 |
316F5F64-F73D-42DC-8632-01E308B6**** |
| Data |
object |
資料概覽。 |
|
| NamespaceId |
string |
命名空間 ID。 |
cn-shanghai |
| ScMockItemJson |
string |
HTTP 協議 Mock 規則。 |
[{"oper":"return+json","Path":"/mock","Value":"{\n \"date\": \"2021-09-10T07:45:12.357+0000\",\n \"name\": \"name\",\n \"id\": \"1\"\n}","Method":"GET","Condition":"AND","Timeout":1,"ArgumentMockItems":[{"type":"param","name":"id","value":"1","cond":"==","operator":"rawvalue"},{"type":"param","name":"name","value":"aliyun","cond":"==","operator":"rawvalue"}]}] |
| ConsumerAppName |
string |
需查詢的應用程式名稱。 |
demo-xxxx |
| ConsumerAppId |
string |
服務消費者應用 ID。 |
hkhon1po62@a000601b265xxxx |
| AccountId |
string |
賬戶 ID。 |
178432728867xxxx |
| ExtraJson |
string |
描述。 |
desc |
| Source |
string |
來源 |
edasmsc |
| Region |
string |
地區。 |
cn-shanghai |
| ProviderAppId |
string |
服務提供者應用 ID。 |
hkhon1po62@a000601b265xxxx |
| ProviderAppName |
string |
服務提供者應用程式名稱。 |
demo-xxxx |
| Name |
string |
名稱。 |
mse-bc1a29b0-160230875****-reg-center-0-1 |
| Id |
integer |
規則 ID。 |
275 |
| Enable |
boolean |
開啟或關閉。
|
true |
| MockType |
integer |
模型類型,取值如下:
|
0 |
| Code |
integer |
返回碼。 |
200 |
| Success |
boolean |
請求結果,取值如下:
|
true |
樣本
正常返回樣本
JSON格式
{
"HttpStatusCode": 200,
"Message": "Succ",
"RequestId": "316F5F64-F73D-42DC-8632-01E308B6****",
"Data": {
"NamespaceId": "cn-shanghai",
"ScMockItemJson": "[{\"oper\":\"return+json\",\"Path\":\"/mock\",\"Value\":\"{\\n \\\"date\\\": \\\"2021-09-10T07:45:12.357+0000\\\",\\n \\\"name\\\": \\\"name\\\",\\n \\\"id\\\": \\\"1\\\"\\n}\",\"Method\":\"GET\",\"Condition\":\"AND\",\"Timeout\":1,\"ArgumentMockItems\":[{\"type\":\"param\",\"name\":\"id\",\"value\":\"1\",\"cond\":\"==\",\"operator\":\"rawvalue\"},{\"type\":\"param\",\"name\":\"name\",\"value\":\"aliyun\",\"cond\":\"==\",\"operator\":\"rawvalue\"}]}]",
"ConsumerAppName": "demo-xxxx",
"ConsumerAppId": "hkhon1po62@a000601b265xxxx",
"AccountId": "178432728867xxxx",
"ExtraJson": "desc",
"Source": "edasmsc",
"Region": "cn-shanghai",
"ProviderAppId": "hkhon1po62@a000601b265xxxx",
"ProviderAppName": "demo-xxxx",
"Name": "mse-bc1a29b0-160230875****-reg-center-0-1",
"Id": 275,
"Enable": true,
"MockType": 0
},
"Code": 200,
"Success": true
}
錯誤碼
|
HTTP status code |
錯誤碼 |
錯誤資訊 |
描述 |
|---|---|---|---|
| 400 | IllegalRequest | Invalid request:%s | 非法請求: %s |
| 400 | InvalidParameter | Parameter error:%s | 請求參數錯誤:%s |
| 500 | InternalError | Console error. Try again later:%s | 控制台錯誤.稍後重試:%s |
| 403 | NoPermission | You are not authorized to perform this operation:%s | 沒有許可權使用此介面:%s |
| 404 | NotFound | Not found:%s | 資源不存在:%s |
訪問錯誤中心查看更多錯誤碼。
變更歷史
更多資訊,參考變更詳情。