Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API接口文档 #3

Closed
bailicangdu opened this issue May 3, 2017 · 0 comments
Closed

API接口文档 #3

bailicangdu opened this issue May 3, 2017 · 0 comments

Comments

@bailicangdu
Copy link
Owner

bailicangdu commented May 3, 2017

域名: http://cangdu.org

端口:8001

1.获取城市列表

请求URL:

/v1/cities

示例:

http://cangdu.org:8001/v1/cities?type=guess

请求方式:

GET

请求参数

参数 是否必选 类型 说明
type     Y       string  类型 guess:定位城市, hot:热门城市, group:所有城市

返回示例

{
  id: 1,
  name: "上海",
  abbr: "SH",
  area_code: "021",
  sort: 1,
  latitude: 31.23037,
  longitude: 121.473701,
  is_map: true,
  pinyin: "shanghai"
}

2.获取所选城市信息

请求URL

/v1/cities/:id

示例:

http://cangdu.org:8001/v1/cities/1

请求方式

GET

请求参数

参数 是否必选 类型 说明
id     Y       int   城市id

返回示例

{
  id: 1,
  name: "上海",
  abbr: "SH",
  area_code: "021",
  sort: 1,
  latitude: 31.23037,
  longitude: 121.473701,
  is_map: true,
  pinyin: "shanghai"
}

3.搜索地址

请求URL

/v1/pois

示例:

http://cangdu.org:8001/v1/pois?city_id=1&keyword=迪士尼&type=search

请求方式

GET

请求参数

参数 是否必选 类型 说明
city_id     Y       int   城市id
keyword     Y       string   搜索关键词
type     N       string   搜索类型,默认为search

返回示例

[
    {
        name: "上海迪士尼乐园",
        address: "上海市浦东新区申迪西路753号",
        latitude: 31.14419,
        longitude: 121.66034,
        geohash: "31.14419,121.66034"
    },
    {
        name: "迪士尼",
        address: "上海市浦东新区妙境路1118号家乐福川沙店1层",
        latitude: 31.18183,
        longitude: 121.69279,
        geohash: "31.18183,121.69279"
    },
    ...  //共10个数据
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant