Skip to content

MockService

Mock Service Management - Unified configuration hub for organizing mock interfaces and virtual runtime environments


Query the list of mock service

GET
/api/v1/mock/service

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

查询参数

id
类型integer
format"int64"
projectId*

Project ID, required when creating a service

类型integer
必填
format"int64"
name
类型string
nodeIp
类型string
nodeId
类型integer
format"int64"
source
类型string
枚举
"CREATED""FILE_IMPORT""ASSOC_SERVICE"
createdBy
类型integer
format"int64"
createdDate
类型string
format"date-time"
pageNo

Page data size, default 1, maximum 100000

类型integer
format"int32"
maximum100000
minimum1
pageSize

Page data size, default 10, maximum 2000

类型integer
format"int32"
maximum2000
minimum1
orderBy

Sort field

类型string
orderSort

Sorting method

类型string
枚举
"ASC""DESC"
filters[0].key

Filter field name

类型string
filters[0].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[0].value

Filter value

filters[1].key

Filter field name

类型string
filters[1].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[1].value

Filter value

filters[2].key

Filter field name

类型string
filters[2].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[2].value

Filter value

infoScope

Query information scope

类型string
枚举
"BASIC""DETAIL"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Replace mock service

PUT
/api/v1/mock/service

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
{
"id": 1,
"projectId": 0,
"name": "XCAN-ANGUSAPI.BOOT",
"nodeId": 1,
"servicePort": 80,
"serviceDomain": "service1.angusmock.cloud",
"apisSecurity": [
{
"in": "header",
"keyName": "Authorization",
"value": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
}
],
"apisCors": {
"allowCorsOrigin": "*",
"allowCorsCredentials": true,
"allowCorsRequestHeaders": "string",
"allowCorsRequestMethods": "GET, POST, PUT, PATCH, DELETE, OPTION, HEAD",
"allowExposeHeaders": "string",
"enabled": true
},
"setting": {
"useSsl": true,
"workThreadNum": 0,
"enableNettyLog": true,
"logFileLevel": "string",
"sendRequestLog": true,
"maxContentLength": 0,
"workPushbackThreadNum": 0,
"maxPushbackConnectTimeout": 0,
"maxPushbackRequestTimeout": 0
}
}

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Add mock service

POST
/api/v1/mock/service

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
{
"projectId": 0,
"name": "XCAN-ANGUSAPI.BOOT",
"nodeId": 0,
"servicePort": 80,
"serviceDomain": "service1.angusmock.cloud",
"apisSecurity": [
{
"in": "header",
"keyName": "Authorization",
"value": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
}
],
"apisCors": {
"allowCorsOrigin": "*",
"allowCorsCredentials": true,
"allowCorsRequestHeaders": "string",
"allowCorsRequestMethods": "GET, POST, PUT, PATCH, DELETE, OPTION, HEAD",
"allowExposeHeaders": "string",
"enabled": true
},
"setting": {
"useSsl": true,
"workThreadNum": 0,
"enableNettyLog": true,
"logFileLevel": "string",
"sendRequestLog": true,
"maxContentLength": 0,
"workPushbackThreadNum": 0,
"maxPushbackConnectTimeout": 0,
"maxPushbackRequestTimeout": 0
}
}

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Delete mock services

DELETE
/api/v1/mock/service

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

查询参数

ids*

Mock service ids

类型array
必填
maxItems200
minItems0
uniqueItemstrue
force

Force deletion flag

类型boolean

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Update mock service

PATCH
/api/v1/mock/service

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
{
"id": 0,
"name": "XCAN-ANGUSAPI.BOOT",
"serviceDomain": "service1.angusmock.cloud",
"apisSecurity": [
{
"in": "header",
"keyName": "Authorization",
"value": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
}
],
"apisCors": {
"allowCorsOrigin": "*",
"allowCorsCredentials": true,
"allowCorsRequestHeaders": "string",
"allowCorsRequestMethods": "GET, POST, PUT, PATCH, DELETE, OPTION, HEAD",
"allowExposeHeaders": "string",
"enabled": true
},
"setting": {
"useSsl": true,
"workThreadNum": 0,
"enableNettyLog": true,
"logFileLevel": "string",
"sendRequestLog": true,
"maxContentLength": 0,
"workPushbackThreadNum": 0,
"maxPushbackConnectTimeout": 0,
"maxPushbackRequestTimeout": 0
}
}

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Synchronize the service setting and apis to mock service instance

PUT
/api/v1/mock/service/{id}/instance/sync

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

id*

Mock service id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Associated mock service based on the service

PUT
/api/v1/mock/service/association/{mockServiceId}/{serviceId}

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

mockServiceId*

Mock service id

类型integer
必填
format"int64"
serviceId*

Services id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Import the mock apis example

POST
/api/v1/mock/service/{id}/example/apis/import

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

id*

Mock service id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Stop mock service by agent

POST
/api/v1/mock/service/stop

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
[
0
]

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Start mock service by agent

POST
/api/v1/mock/service/start

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
[
0
]

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Import the apis to existed mock service

POST
/api/v1/mock/service/import

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

multipart/form-data
object

Import mock service id

格式"int64"

Strategy for handling duplicate apis. The COVER value overrides the local api, and the IGNORE value ignores the synchronization current api

有效值"COVER""IGNORE"

The delete flag when not existed. Whether to delete a local api when it does not exist in the current synchronized data

Apis specification content. API definition string content in json or yaml format, multiple files import is not supported

Apis specification file. API definition file in json or yaml format, multiple files need to be compressed into a zip file before uploading

格式"binary"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Import the mock service from file

POST
/api/v1/mock/service/file/import

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

multipart/form-data
object

Project ID, required when creating a service

格式"int64"

Import the source of the mock service

有效值"OPENAPI""POSTMAN""ANGUS"

Apis document file, the apis documents file and text must specify one, and only import file when both exist

格式"binary"

Apis document text, the apis documents file and text must specify one, and only import file when both exist

Mock service name

最小长度1

Specify the mock service running node ID

格式"int64"

Specify the port on which to run the service on the node

格式"int32"

The cloud service edition is fixed at xxx.angusmock.cloud, and the privatized version allows users to freely enter the domain name

object[]

Mock request authentication configuration

object

Mock request CORS configuration

object

Mock service configuration

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Import the mock service example

POST
/api/v1/mock/service/example/import

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

查询参数

projectId*

Project id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Generate associated mock service based on the service

POST
/api/v1/mock/service/association/services

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

请求体

application/json
JSON
{
"serviceId": 0,
"name": "XCAN-ANGUSAPI.BOOT",
"nodeId": 0,
"servicePort": 80,
"serviceDomain": "service1.angusmock.cloud",
"apiIds": [
0
],
"apisSecurity": [
{
"in": "header",
"keyName": "Authorization",
"value": "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
}
],
"apisCors": {
"allowCorsOrigin": "*",
"allowCorsCredentials": true,
"allowCorsRequestHeaders": "string",
"allowCorsRequestMethods": "GET, POST, PUT, PATCH, DELETE, OPTION, HEAD",
"allowExposeHeaders": "string",
"enabled": true
},
"setting": {
"useSsl": true,
"workThreadNum": 0,
"enableNettyLog": true,
"logFileLevel": "string",
"sendRequestLog": true,
"maxContentLength": 0,
"workPushbackThreadNum": 0,
"maxPushbackConnectTimeout": 0,
"maxPushbackRequestTimeout": 0
}
}

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
主体

示例

cURL
JavaScript
PHP
Python

Query the detail of mock service

GET
/api/v1/mock/service/{id}

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

id*

Mock service id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Query the associated apis ids of mock service

GET
/api/v1/mock/service/{id}/association/apis/id

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

id*

Mock service id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Fulltext search the list of mock service

GET
/api/v1/mock/service/search
UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

查询参数

id
类型integer
format"int64"
projectId*

Project ID, required when creating a service

类型integer
必填
format"int64"
name
类型string
nodeIp
类型string
nodeId
类型integer
format"int64"
source
类型string
枚举
"CREATED""FILE_IMPORT""ASSOC_SERVICE"
createdBy
类型integer
format"int64"
createdDate
类型string
format"date-time"
pageNo

Page data size, default 1, maximum 100000

类型integer
format"int32"
maximum100000
minimum1
pageSize

Page data size, default 10, maximum 2000

类型integer
format"int32"
maximum2000
minimum1
orderBy

Sort field

类型string
orderSort

Sorting method

类型string
枚举
"ASC""DESC"
filters[0].key

Filter field name

类型string
filters[0].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[0].value

Filter value

filters[1].key

Filter field name

类型string
filters[1].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[1].value

Filter value

filters[2].key

Filter field name

类型string
filters[2].op

Filter condition (EQUAL, NOT_EQUAL, GREATER_THAN, etc.)

类型string
枚举
"GREATER_THAN""LESS_THAN""GREATER_THAN_EQUAL""LESS_THAN_EQUAL""EQUAL""NOT_EQUAL""MATCH""MATCH_END""NOT_MATCH""NOT_MATCH_END""IN""NOT_IN""IS_NULL""IS_NOT_NULL"
filters[2].value

Filter value

infoScope

Query information scope

类型string
枚举
"BASIC""DETAIL"

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}
授权
变量
cURL
JavaScript
PHP
Python

Export the apis from existed mock service

GET
/api/v1/mock/service/export

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

查询参数

mockServiceId*

Export mock service id

类型integer
必填
format"int64"
mockApiIds

Export apis ids. Specify the apis to export when scope is by APIS, export all when not specified

类型array
uniqueItemstrue
format

Mock apis document format. Available values yaml or json, the default value is yaml

类型string
枚举
"yaml""json""yaml, json"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python

Delete the association between mock service and api service

DELETE
/api/v1/mock/service/{id}/association

授权

UserHttpBearer

Use existing opaque tokens for authentication

类型HTTP (bearer)

参数

路径参数

id*

Mock service id

类型integer
必填
format"int64"

响应

OK

*/*
JSON
{
"code": "string",
"msg": "string",
"data": {
},
"datetime": "string",
"ext": {
"additionalProperties": {
}
}
}

试验场

授权
变量

示例

cURL
JavaScript
PHP
Python