接口地址:https://api.istero.com/resource/food/combinations |
---|
返回格式:json |
请求方式:get/post |
请求示例:https://api.istero.com/resource/food/combinations?token=TOKEN&food=玉米 |
名称 | 类型 | 必填 | 说明 |
---|---|---|---|
token | string | 必填 | 对应平台密钥 扫码关注公众号 |
food | string | 必填 | 食物关键字 |
名称 | 类型 | 说明 |
---|---|---|
food1 | string | 食物1 |
food2 | string | 食物2 |
consequence | string | 同时食用会产生的后果 |
{
"code": 200,
"data": {
"lists": [{
"food1": "牡蛎",
"food2": "玉米",
"consequence": "影响吸收"
},
{
"food1": "玉米",
"food2": "田螺",
"consequence": "会引起中毒"
}
]
},
"message": ""
}
错误码 | 说明 |
---|---|
400 | 数据返回错误,“message”显示错误信息 |
401 | TOKEN为空 |
402 | 接口不存在 |
403 | 接口请求失败 |
404 | TOKEN错误/鉴权失败 |
405 | IP白名单规则拦截 |
406 | Referer白名单规则拦截 |
407 | 接口维护中 |
408 | 接口已停止服务 |
500 | 接口服务器错误 |
501 | 余额不足,仅付费接口会出现此状态码 |
502 | 违反平台协议,账号被封锁 |
<?php
/**
* Created by PhpStorm.
* User: FZS
* Time: 2025/01/19 22:11
*/
class freeApi
{
private $apiUrl;
public function __construct()
{
$this->apiUrl = 'https://api.istero.com/resource/food/combinations?token=TOKEN&food=玉米';
}
/**
* 获取结果
* @return array
*/
public function getResult()
{
return file_get_contents($this->apiUrl);
}
}
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
)
const (
APIURL = "https://api.istero.com/resource/food/combinations?token=TOKEN&food=玉米"
)
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))
}