cURL
curl "http://xfxuezhang.cn:8082/api/echo_json?name=hello"
用于测试GET/POST参数是否正常进入API网关。
http://xfxuezhang.cn:8082/api/echo_json
接口调用前需要确认的核心配置。
/api/echo_jsonecho_json必填参数必须传入,示例值可直接用于联调。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
name |
否 | string | 任意字符串,用于回显测试。 | hello |
优先使用示例地址测试请求参数是否正确。
http://xfxuezhang.cn:8082/api/echo_json?name=hello
curl "http://xfxuezhang.cn:8082/api/echo_json?name=hello"
$url = 'http://xfxuezhang.cn:8082/api/echo_json?name=hello';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('http://xfxuezhang.cn:8082/api/echo_json?name=hello')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "echo_json",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
code |
integer | 业务状态码,0 表示请求成功。 | 0 |
msg |
string | 接口调用结果说明。 | success |
data |
object | 接口返回的业务数据。具体字段以对应 API 为准。 | {} |
点击左侧“发送请求”查看结果...