调用EnableMockRule接口开启Mock规则。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求头
该接口使用公共请求头,无特殊请求头。
请求语法
POST|GET /pop/sp/api/mock/enableMockRule HTTP/1.1
请求参数
名称 | 类型 | 位置 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|---|
Id | Long | Query | 是 | 275 |
规则ID。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Code | Integer | 200 |
响应码。 |
Message | String | success |
返回信息。 |
RequestId | String | 210f470316315038639725978eb3b8 |
请求ID。 |
Success | Boolean | true |
返回结果。
|
Data | Object |
返回值。 |
|
NamespaceId | String | cn-shanghai |
微服务空间ID。 |
ScMockItemJson | String | [{"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"}]}] |
HTTP协议Mock规则。 |
ConsumerAppName | String | demo-xxxx |
消费者应用名称。 |
AccountId | String | 178432728867xxxx |
账号ID。 |
ConsumerAppId | String | hkhon1po62@a000601b265xxxx |
消费者应用ID。 |
ExtraJson | String | {} |
描述。 |
Source | String | edasmsc |
来源。 |
Region | String | cn-shanghai |
地域。 |
ProviderAppId | String | hkhon1po62@a000601b265xxxx |
服务提供者应用ID。 |
Name | String | name |
规则名称。 |
ProviderAppName | String | demo-xxxx |
服务提供者应用名称 |
Id | Long | 275 |
规则ID。 |
Enable | Boolean | true |
开启或关闭。
|
示例
请求示例
POST /pop/sp/api/mock/enableMockRule HTTP/1.1
公共请求头
{
"Id": "275"
}
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<EnableMockRuleResponse>
<RequestId>210f470316315038639725978eb3b8</RequestId>
<Message>success</Message>
<Data>
<ConsumerAppName>demo-xxxx</ConsumerAppName>
<AccountId>178432728867xxxx</AccountId>
<ProviderAppId>hkhon1po62@a000601b265xxxx</ProviderAppId>
<ProviderAppName>demo-xxxx</ProviderAppName>
<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"}]}]</ScMockItemJson>
<ConsumerAppId>hkhon1po62@a000601b265xxxx</ConsumerAppId>
<Region>cn-shanghai</Region>
<Enable>true</Enable>
<NamespaceId>cn-shanghai</NamespaceId>
<Id>275</Id>
<ExtraJson>{}</ExtraJson>
<Source>edasmsc</Source>
<Name>name</Name>
</Data>
<Code>200</Code>
<Success>true</Success>
</EnableMockRuleResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "210f470316315038639725978eb3b8",
"Message" : "success",
"Data" : {
"ConsumerAppName" : "demo-xxxx",
"AccountId" : "178432728867xxxx",
"ProviderAppId" : "hkhon1po62@a000601b265xxxx",
"ProviderAppName" : "demo-xxxx",
"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\"}]}]",
"ConsumerAppId" : "hkhon1po62@a000601b265xxxx",
"Region" : "cn-shanghai",
"Enable" : true,
"NamespaceId" : "cn-shanghai",
"Id" : 275,
"ExtraJson" : "{}",
"Source" : "edasmsc",
"Name" : "name"
},
"Code" : 200,
"Success" : true
}