接口地址:https://way.jd.com/showapi/dtgxt |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://way.jd.com/showapi/dtgxt?page=1&maxResult=20&appkey=您申请的APPKEY |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
appkey | sting | 必填 | 该平台的appkey 扫码关注公众号 |
page | int | 必填 | 每页数量 默认1 |
maxResult | int | 必填 | 最大结果集 |
名称 | 类型 | 说明 |
---|---|---|
showapi_res_error | string | 错误描述 |
showapi_res_code | number | 系统级错误码,为0时表示调用成功,其他值为失败 |
showapi_res_body | object | 返回的内容 |
maxResult | number | 最大结果集 |
currentPage | number | 当前页数 |
allNum | number | 总条数 |
ret_code | number | 接口级错误码,为0时表示调用成功,其他值为失败 |
contentlist | array | 内容列表 |
type | number | 忽略 |
id | string | 忽略 |
img | string | 图片地址 |
title | string | 笑话标题 |
ct | string | 数据收录时间 |
allPages | number | 总页数 |
{
"code": "10000",
"charge": false,
"msg": "查询成功",
"result": {
"showapi_res_code": 0,
"showapi_res_error": "",
"showapi_res_body": {
"allNum": 7892,
"allPages": 395,
"contentlist": [{
"ct": "2016-05-30 16:30:27.242",
"id": "574bfa236e36c1d5f9289678",
"img": "http://www.zbjuran.com/uploads/allimg/160530/2-160530145631924.gif",
"title": "要不要来个鸳鸯戏水呢",
"type": 3
}, {
"ct": "2016-05-30 16:30:27.239",
"id": "574bfa236e36c1d5f9289677",
"img": "http://www.zbjuran.com/uploads/allimg/160530/2-160530151R09B.gif",
"title": "翻滚的美少女",
"type": 3
}],
"currentPage": 1,
"maxResult": 20,
"ret_code": 0
}
}
}
错误码 | 说明 |
---|---|
10001 | 错误的请求appkey |
11010 | 商家接口调用异常,请稍后再试 |
11030 | 商家接口返回格式有误 |
10003 | 不存在相应的数据信息 |
10004 | URL上appkey参数不能为空 |
10010 | 接口需要付费,请充值 |
10020 | 万象系统繁忙,请稍后再试 |
10030 | 调用万象网关失败, 请与万象联系 |
10040 | 超过每天限量,请明天继续 |
10050 | 用户已被禁用 |
10060 | 提供方设置调用权限,请联系提供方 |
10070 | 该数据只允许企业用户调用 |
10090 | 文件大小超限,请上传小于1M的文件 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2021/01/01 21:26
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = ' https://way.jd.com/showapi/dtgxt?page=1&maxResult=20&appkey=您申请的APPKEY';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://way.jd.com/showapi/dtgxt?page=1&maxResult=20&appkey=您申请的APPKEY"
)
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))
}