创建环境
POST
https://api.apifox.com/api/v1/projects/{projectId}/environments请求参数
Path 参数
projectId
string
必需
示例值:
2078457
Body 参数application/json
name
string
必需
baseUrls
string
必需
序列化后的 JSON
variables
string
必需
序列化后的 JSON
visibility
string
可选
protected 表示共有
示例
{
"name": "测试环境2",
"baseUrls": "{ \"default\": \"http://127.0.0.1:8888\"}",
"visibility": "protected",
"variables": "[{\"name\":\"envVar\",\"value\":\"1\",\"description\":\"envVar desc\",\"isFixedValue\":true}]"
}
示例代码
返回响应
成功(200)
HTTP 状态码: 200
内容格式: JSONapplication/json
数据结构
data
object (Environment)
必需
parameters
object | null
必需
variables
array[object (Variable) {2}] | null
环境变量
id
integer
必需
name
string
必需
baseUrl
string
必需
creatorId
integer
必需
editorId
integer
必需
projectId
integer
必需
ordering
integer
必需
updatedAt
string
必需
createdAt
string
必需
servers
array [object {3}]
可选
registrationCenters
array [object]
可选
success
boolean
必需
示例
{
"data": {
"baseUrl": "http://127.0.0.1:8888",
"baseUrls": {
"default": "http://127.0.0.1:8888"
},
"parameters": {
"cookie": [],
"query": [],
"header": [],
"body": []
},
"variables": [
{
"name": "envVar",
"value": "1",
"description": "envVar desc",
"isFixedValue": true
}
],
"registrationCenters": [],
"tags": [],
"type": "normal",
"id": 18411999,
"projectType": "HTTP",
"name": "测试环境",
"visibility": "protected",
"creatorId": 377134,
"editorId": 377134,
"projectId": 2074249,
"ordering": 30,
"updatedAt": "2024-02-27T03:03:24.329Z",
"createdAt": "2024-02-27T03:03:24.329Z"
},
"success": true
}
最后修改时间: 9 个月前