Membuat aturan mock.
Coba sekarang
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
mse:AddMockRule |
*全部资源
|
None | None |
Parameter permintaan
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
Nama aturan. |
agent-auto-test-sc |
| Region |
string |
Yes |
ID wilayah. |
cn-hangzhou |
| Source |
string |
Yes |
Sumber aturan. |
edasmsc |
| ProviderAppId |
string |
No |
ID aplikasi penyedia. |
dcqtkuhnc4@66e5235415**** |
| ProviderAppName |
string |
No |
Nama aplikasi penyedia. |
demo-cartservice |
| ExtraJson |
string |
Yes |
Deskripsi. |
{} |
| ScMockItems |
string |
Yes |
Parameter input. Nilai harus berupa string JSON. |
[] |
| DubboMockItems |
string |
Yes |
Menentukan Proyek di Keranjang daur ulang. |
[] |
| ConsumerAppIds |
string |
Yes |
ID aplikasi kustom. |
[{\"appName\":\"provide\",\"appId\":\"bst8l6o735@f6d8aaf6e56e67d\"}] |
| Enable |
boolean |
No |
Apakah akan mengaktifkan aturan mock. Nilai valid:
|
true |
| MockType |
integer |
No |
Menentukan pengatur waktu tanggapan (RT) panggilan lambat. Nilai valid:
|
1 |
| AcceptLanguage |
string |
No |
Bahasa tanggapan. Nilai valid:
|
zh |
Elemen respons
|
Element |
Type |
Description |
Example |
|
object |
The data structure. |
||
| HttpStatusCode |
integer |
The HTTP status code. |
200 |
| Message |
string |
The returned message. |
Succ |
| RequestId |
string |
The request ID. |
316F5F64-F73D-42DC-8632-01E308B6**** |
| Data |
object |
Data Overview. |
|
| NamespaceId |
string |
The namespace ID. |
cn-shanghai |
| ScMockItemJson |
string |
The mock rule for the HTTP protocol. |
[{"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 |
The name of the application to query. |
demo-xxxx |
| ConsumerAppId |
string |
The ID of the consumer application. |
hkhon1po62@a000601b265xxxx |
| AccountId |
string |
The account ID. |
178432728867xxxx |
| ExtraJson |
string |
The description. |
desc |
| Source |
string |
The source. |
edasmsc |
| Region |
string |
The region. |
cn-shanghai |
| ProviderAppId |
string |
The ID of the provider application. |
hkhon1po62@a000601b265xxxx |
| ProviderAppName |
string |
The name of the provider application. |
demo-xxxx |
| Name |
string |
The name. |
mse-bc1a29b0-160230875****-reg-center-0-1 |
| Id |
integer |
The rule ID. |
275 |
| Enable |
boolean |
Indicates whether the rule is enabled.
|
true |
| MockType |
integer |
The model type. Valid values:
|
0 |
| Code |
integer |
The return code. |
200 |
| Success |
boolean |
Indicates whether the request was successful. Valid values:
|
true |
Contoh
Respons sukses
JSONformat
{
"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
}
Kode kesalahan
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IllegalRequest | Invalid request:%s | |
| 400 | InvalidParameter | Parameter error:%s | |
| 500 | InternalError | Console error. Try again later:%s | |
| 403 | NoPermission | You are not authorized to perform this operation:%s | |
| 404 | NotFound | Not found:%s |
Lihat Error Codes untuk daftar lengkap.
Catatan rilis
Lihat Release Notes untuk daftar lengkap.