调用GetMockRuleById接口查询Mock规则。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求头

该接口使用公共请求头,无特殊请求头。请参见公共请求参数文档。

请求语法

POST /pop/sp/api/mock/getMockRuleById HTTP/1.1

请求参数

名称 类型 位置 是否必选 示例值 描述
Id Long Query 275

规则ID。

返回数据

名称 类型 示例值 描述
Code String 200

响应码。

Data Struct

返回值。

AccountId String 178432728867****

账户ID。

ConsumerAppId String hkhon1po62@a000601b265****

服务消费者应用ID。

ConsumerAppName String demo-****

服务消费者应用名称。

DubboMockItems Array of DubboMockItem

DUBBO协议Mock规则。

ExceptionClassName String com.alibabacloud.hipstershop.cartserviceapi.service.CartService

异常类名

ExceptionMessage String NullPointException

异常消息

ExecuteCondition String FORCE

异常条件

Group String demo

分组

MethodName String mock

方法名

Oper String ==

操作

ParamTypes String ["java.lang.String","com.alibabacloud.hipstershop.cartserviceapi.domain.CartItem"]

参数类型

Path String dubbo://127.0.0.XXXX:XX

路径

ServiceName String com.alibabacloud.hipstershop.cartserviceapi.service.CartService

服务名

Value String {"name": "aliyun"}

Mock值

Version String 1.0.0

版本

Enable Boolean true

开启或关闭。

  • true:开启。
  • false:关闭。
ExtraJson String {}

描述。

Id Long 275

规则ID。

Name String demo

规则名称。

ProviderAppId String hkhon1po62@a000601b265****

服务提供者应用ID。

ProviderAppName String demo-xxxx

服务提供者应用名称。

Region String cn-shanghai

地域。

ScMockItems Array of SpringCloudMockItem

HTTP协议Mock规则。

ExceptionClassName String com.alibabacloud.hipstershop.cartserviceapi.service.CartService

异常类名

ExecuteCondition String NullPointException

异常条件

Method String GET

方法

Oper String ==

操作

Path String /mock

路径

ServiceName String productService

服务名

Value String {"name": "aliyun"}

Mock返回值

Source String edasmsc

来源。

Message String success

返回信息。

RequestId String 210f470316315038639725978eb3b8****

请求ID。

Success Boolean true

返回结果。

  • true:返回成功。
  • false:返回失败。

示例

请求示例

POST /pop/sp/api/mock/getMockRuleById HTTP/1.1
公共请求头
{
"Id": "275"
}

正常返回示例

XML格式

<GetMockRuleByIdResponse>
  <RequestId>210f470316315038639725978eb3b8****</RequestId>
  <Message>success</Message>
  <Data>
        <ConsumerAppName>demo-****</ConsumerAppName>
        <AccountId>178432728867****</AccountId>
        <ProviderAppId>hkhon1po62@a000601b265****</ProviderAppId>
        <ProviderAppName>demo-xxxx</ProviderAppName>
        <ConsumerAppId>hkhon1po62@a000601b265****</ConsumerAppId>
        <Region>cn-shanghai</Region>
        <Enable>true</Enable>
        <Id>275</Id>
        <ExtraJson>{}</ExtraJson>
        <Source>edasmsc</Source>
        <Name>demo</Name>
        <ScMockItems>
              <Path>/mock</Path>
              <ServiceName>productService</ServiceName>
              <ExceptionClassName>com.alibabacloud.hipstershop.cartserviceapi.service.CartService</ExceptionClassName>
              <Value>{"name": "aliyun"}</Value>
              <Oper>==</Oper>
              <Method>GET</Method>
              <ExecuteCondition>NullPointException</ExecuteCondition>
        </ScMockItems>
        <DubboMockItems>
              <ParamTypes>["java.lang.String","com.alibabacloud.hipstershop.cartserviceapi.domain.CartItem"]</ParamTypes>
              <Path>dubbo://127.0.0.XXXX:XX</Path>
              <Group>demo</Group>
              <ExceptionMessage>NullPointException</ExceptionMessage>
              <Version>1.0.0</Version>
              <ServiceName>com.alibabacloud.hipstershop.cartserviceapi.service.CartService</ServiceName>
              <ExceptionClassName>com.alibabacloud.hipstershop.cartserviceapi.service.CartService</ExceptionClassName>
              <Value>{"name": "aliyun"}</Value>
              <Oper>==</Oper>
              <MethodName>mock</MethodName>
              <ExecuteCondition>FORCE</ExecuteCondition>
        </DubboMockItems>
  </Data>
  <Code>200</Code>
  <Success>true</Success>
</GetMockRuleByIdResponse>

JSON格式

{
    "GetMockRuleByIdResponse": {
        "RequestId": "210f470316315038639725978eb3b8****",
        "Message": "success",
        "Data": {
            "ConsumerAppName": "demo-****",
            "AccountId": "178432728867****",
            "ProviderAppId": "hkhon1po62@a000601b265****",
            "ProviderAppName": "demo-xxxx",
            "ConsumerAppId": "hkhon1po62@a000601b265****",
            "Region": "cn-shanghai",
            "Enable": true,
            "Id": 275,
            "ExtraJson": "{}",
            "Source": "edasmsc",
            "Name": "demo",
            "ScMockItems": {
                "Path": "/mock",
                "ServiceName": "productService",
                "ExceptionClassName": "com.alibabacloud.hipstershop.cartserviceapi.service.CartService",
                "Value": "{\"name\": \"aliyun\"}",
                "Oper": "==",
                "Method": "GET",
                "ExecuteCondition": "NullPointException"
            },
            "DubboMockItems": {
                "ParamTypes": "[\"java.lang.String\",\"com.alibabacloud.hipstershop.cartserviceapi.domain.CartItem\"]",
                "Path": "dubbo://127.0.0.XXXX:XX",
                "Group": "demo",
                "ExceptionMessage": "NullPointException",
                "Version": "1.0.0",
                "ServiceName": "com.alibabacloud.hipstershop.cartserviceapi.service.CartService",
                "ExceptionClassName": "com.alibabacloud.hipstershop.cartserviceapi.service.CartService",
                "Value": "{\"name\": \"aliyun\"}",
                "Oper": "==",
                "MethodName": "mock",
                "ExecuteCondition": "FORCE"
            }
        },
        "Code": 200,
        "Success": true
    }
}