cURL
curl "https://api.mxroc.com/api/weather_city_id?city=%E5%8C%97%E4%BA%AC"
查询演示城市对应的天气ID。
https://api.mxroc.com/api/weather_city_id
接口调用前需要确认的核心配置。
/api/weather_city_idweather_city_id必填参数必须传入,示例值可直接用于联调。
| 参数名 | 必填 | 类型 | 说明 | 示例值 |
|---|---|---|---|---|
city |
是 | string | 城市名称。 | 北京 |
优先使用示例地址测试请求参数是否正确。
https://api.mxroc.com/api/weather_city_id?city=%E5%8C%97%E4%BA%AC
curl "https://api.mxroc.com/api/weather_city_id?city=%E5%8C%97%E4%BA%AC"
$url = 'https://api.mxroc.com/api/weather_city_id?city=%E5%8C%97%E4%BA%AC';
$response = file_get_contents($url);
$data = json_decode($response, true);
fetch('https://api.mxroc.com/api/weather_city_id?city=%E5%8C%97%E4%BA%AC')
.then(res => res.json())
.then(data => console.log(data));
实际返回内容以接口脚本处理结果为准。
{
"code": 0,
"msg": "success",
"data": {
"route": "weather_city_id",
"example": true
}
}
| 参数名 | 类型 | 说明 | 示例值 |
|---|---|---|---|
code |
integer | 业务状态码,0 表示请求成功。 | 0 |
msg |
string | 接口调用结果说明。 | success |
data |
object | 接口返回的业务数据。具体字段以对应 API 为准。 | {} |
点击左侧“发送请求”查看结果...