Contact Us
Back top
Current Location : APIs > 百度外卖
百度外卖 Transactions( 62 )

百度外卖

723

Intro. : 输入经纬度返回附近外卖商家信息

Tag : 外卖

On Shelves Time : 2017-05-01

Type :

Total invocations(updated per hour)

百度外卖 ¥ 1.00 yuan/100calls 辅助工具 每天免费测试 30

接口服务

接口延迟等级: 低(1~3秒内) 平台反爬等级: 低(6个月更改1次)
平台升级频率: 低(6个月升级1次)

数据指标

最大数据量: 无限制 最大页数: 无限制
每页数据量: 20 数据实时性: 实时
数据回溯性: 全部 数据排序项: 平台默认
缺失的数据字段: 暂无 备注: 暂无

API Mark

Example

注: 该接口为实时数据接口,可能受目标平台或网络状态影响,会存在一定的错误率,建议在程序中加入出错重试机制。
Error Code
-- 请求示例 url 默认请求参数已经做URL编码 curl -i "http://api01.idataapi.cn:8000/restaurant/baiduwaimai?apikey={Your apikey}&geo=116.446626%2C39.930412"
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.net.URL; import java.nio.charset.Charset; import org.json.JSONException; import org.json.JSONObject; import java.io.PrintWriter; import java.net.URLConnection; public class Example { private static String readAll(Reader rd) throws IOException { StringBuilder sb = new StringBuilder(); int cp; while ((cp = rd.read()) != -1) { sb.append((char) cp); } return sb.toString(); } public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); conn.setDoOutput(true); conn.setDoInput(true); PrintWriter out = new PrintWriter(conn.getOutputStream()); out.print(body); out.flush(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException { URL realUrl = new URL(url); URLConnection conn = realUrl.openConnection(); InputStream instream = conn.getInputStream(); try { BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8"))); String jsonText = readAll(rd); JSONObject json = new JSONObject(jsonText); return json; } finally { instream.close(); } } public static void main(String[] args) throws IOException, JSONException { // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.idataapi.cn:8000/restaurant/baiduwaimai?apikey={Your apikey}&geo=116.446626%2C39.930412"; JSONObject json = getRequestFromUrl(url);; System.out.println(json.toString()); } }
//using System.Net.Security; //using System.Security.Cryptography.X509Certificates; private const String method = "GET"; static void Main(string[] args) { String bodys = ""; // 请求示例 url 默认请求参数已经做URL编码 String url = "http://api01.idataapi.cn:8000/restaurant/baiduwaimai?apikey={Your apikey}&geo=116.446626%2C39.930412"; HttpWebRequest httpRequest = null; HttpWebResponse httpResponse = null; if (url.Contains("https://")) { ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult); httpRequest = (HttpWebRequest)WebRequest.CreateDefault(new Uri(url)); } else { httpRequest = (HttpWebRequest)WebRequest.Create(url); } httpRequest.Method = method; if (0 < bodys.Length) { byte[] data = Encoding.UTF8.GetBytes(bodys); using (Stream stream = httpRequest.GetRequestStream()) { stream.Write(data, 0, data.Length); } } try { httpResponse = (HttpWebResponse)httpRequest.GetResponse(); } catch (WebException ex) { httpResponse = (HttpWebResponse)ex.Response; } Console.WriteLine(httpResponse.StatusCode); Console.WriteLine(httpResponse.Method); Console.WriteLine(httpResponse.Headers); Stream st = httpResponse.GetResponseStream(); StreamReader reader = new StreamReader(st, Encoding.GetEncoding("utf-8")); Console.WriteLine(reader.ReadToEnd()); Console.WriteLine("\n"); } public static bool CheckValidationResult(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors errors) { return true; }
<?php $method = "GET"; // 请求示例 url 默认请求参数已经做URL编码 $url = "http://api01.idataapi.cn:8000/restaurant/baiduwaimai?apikey={Your apikey}&geo=116.446626%2C39.930412"; $curl = curl_init(); curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_FAILONERROR, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING, "gzip"); var_dump(curl_exec($curl)); ?>
# coding:utf-8 """ Compatible for python2.x and python3.x requirement: pip install requests """ from __future__ import print_function import requests # 请求示例 url 默认请求参数已经做URL编码 url = "http://api01.idataapi.cn:8000/restaurant/baiduwaimai?apikey={Your apikey}&geo=116.446626%2C39.930412" headers = { "Accept-Encoding": "gzip", "Connection": "close" } if __name__ == "__main__": r = requests.get(url, headers=headers) json_obj = r.json() print(json_obj)

Request Field( Params marked* means users should choose one from the each marked items to fill in.)

Property Name Type Mandatory Example Description
geo string * 116.446626,39.930412 经纬度(英文半角逗号连接),如:116.446626,39.930412
id string * 1842398340
bd09mc string * 2630252.17,12615410.21
pageToken string pageToken为翻页值,从API返回结果可以拿到。
kw string
catid string

Response Fields

Property Name Type Example Description
  • hasNext boolean true false: 无下一页 true:有下一页
  • retcode string 000000 状态码(详见错误码表)
  • appCode string baiduwaimai 平台代号
  • dataType string restaurant 数据类型
  • pageToken string 2 翻页值 用于获取下一页数据
  • -
    data array [...] 返回数据
    • rating number 4.8 综合评分
    • deliverTime number 59 配送时间
    • +
      ratingDist array [...] 评分分布
      • value number 42489 其它键值对 值
      • key string 全部 其它键值对 键
    • ratingCount number 42489 评分数
    • likeCount string null 点赞数
    • commentCount number 42489 评论数
    • deliverProvider string 商家配送 配送提供商
    • servRating number 4.9 服务评分
    • id string 4909635027123796039 餐馆ID
    • city string null
    • minDeliverFee number 0 最小起送费
    • district string null
    • title string 麻辣诱惑·麻辣小龙虾·麻小外卖 餐馆名
    • +
      goodTagDist array [...] 正面标签分布
      • value number 3192 其它键值对 值
      • key string 味道赞 其它键值对 键
    • state string null 州、省
    • description string 本店欢迎您下单,用餐高峰请提前下单,谢谢! 简介
    • catName1 string null 一级分类名
    • tags array [...] 标签列表
    • monthSaleCount number 8963 月销量
    • +
      geoPoint object {...} 经纬度
      • lat number 39.976028998464 纬度
      • lon number 116.34583471599 经度
    • address string 北京市海淀区巴沟路2号1幢B1-101-38 街道地址
    • avgPrice number 188.1 人均消费
    • imageUrls array [...] 图片列表
    • deliverFee number 20 配送费
    • promotions array [...] 优惠、促销信息
    • url string http://waimai.baidu.com/waimai/shop/4909635027123796039 原平台链接
    • country string null 国家
    • qualRating number 4.8 质量评分
    • telephones string 400-8166188 电话
    • openingHours string 10:00-次日02:30 营业时间

Returns The Sample

null

Detailed Data

No Details

状态码

Status Code Return Value Format : JSON

{

message:"API rate limit exceeded",

retcode:100703

}

The API in our platform is only paid on number of calls. For the detail, please refer to the below table.

Status Code Code Meaning Detailed Description Need paid or not?
000000 invoke successfully(data is not null) 成功调用并返回数据
100002 Search no result 目标参数搜索没结果
100301 Account not found 用户帐号不存在
100303 Search no result 账号未收录
100000 Server internal error 服务器内部错误
100001 Network error 网络错误
100004 Target server error 目标服务器错误
100005 Param error 用户输入参数错误
100700 Invalid authentication credentials 授权失败
100701 API stopped 您的当前API已停用
100702 Account stopped 您的账户已停用
100703 API rate limit exceeded 并发已达上限
100704 API maintenance API维护中
100705 API not found with these values API不存在
100706 Please add api first 请先添加api
100707 Number of calls exceeded 调用次数超限
100802 Missing url param 'time' or uri path is not equal to 2 请求路径错误或者缺少"time"参数
100803 Wrong pageToken 参数pageToken有误

Often With The Purchase Of Data