国内新冠疫情
其他 官方文档
国内新冠疫情
基本说明:
接口地址:https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list
返回格式:json
请求方式:get/post
请求示例:https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf
请求参数说明:
名称 类型 必填 说明
modules string 必填 固定值statisGradeCityDetail、diseaseh5Shelf或statisGradeCityDetail,diseaseh5Shelf
返回参数说明:
名称 类型 说明
- - -
JSON返回示例:
{
	"ret": 0,
	"info": "",
	"data": {
		"statisGradeCityDetail": [{
			"city": "长宁",
			"nowConfirm": 802,
			"heal": 1574,
			"date": "05/05",
			"sdate": "05/05",
			"syear": 2022,
			"province": "上海",
			"confirmAdd": 5,
			"confirm": 2376,
			"dead": 0,
			"grade": "点击查看详情",
			"mtime": "2022-05-05 08:41:46"
		}, {
			"city": "浦东",
			"heal": 14648,
			"mtime": "2022-05-05 08:44:51",
			"sdate": "05/05",
			"province": "上海",
			"nowConfirm": 2143,
			"confirmAdd": 50,
			"confirm": 16792,
			"dead": 1,
			"grade": "点击查看详情",
			"date": "05/05",
			"syear": 2022
		}]
	}
}
服务级错误码参照
错误码 说明
- -
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2022/04/08 11:38
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://api.inews.qq.com/newsqa/v1/query/inner/publish/modules/list?modules=statisGradeCityDetail,diseaseh5Shelf"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}