域名和端口
http://52.24.88.186:8888/
請(qǐng)求格式
對(duì)于POST和PUT請(qǐng)求,請(qǐng)求的主體必須是JSON格式,
錯(cuò)誤返回
正確返回在詳細(xì)中,所有出錯(cuò)返回均為
{
'state':'error',
'error':' error detail'
}
詳細(xì)使用
用戶認(rèn)證
url:
/1.0/authmethed:
post-
發(fā)送參數(shù)
{ type:'', phone_num:'', password:'', } -
返回
{ state:' ', //ok or error [error]:'',//when error [uid]:,// when ok [token]:'', }
用戶取消認(rèn)證
本操作將刪除設(shè)備令牌token
url:
/v1.0/auth/{{uid}}/{{token}}methed:
delete-
返回
{ state:'', //ok or error [error]:'', //error info when error }
獲取用戶信息
url
/v1.0/users/{{uid}}methed
get-
返回
{ uid: , sex: , // 0 for female, 1 for male username:'', phone_num:' ', score: , qq:'', school:'', dept:'', sign,' ', enroll_year:'',//入學(xué)時(shí)間 home_area:' ', home_city:'', home_province:' ', birthday:' ', constellation:' ', hobbies: ' ', image: ' ' }
注冊(cè)
url`/v1.0/users
methed
post-
參數(shù)
{ username = '', image ='', sex = 1 or 0, phone_num = ' ', school = ' ', dept = ' ', enroll_year = ' ',入學(xué)時(shí)間 password = ' '//hash過(guò) } -
返回
{ uid: , token:'', }
修改用戶信息
url
/v1.0/usersmethed :
put-
參數(shù)
{ uid: , token:'', sex: , // 0 for female, 1 for male username:'', phone_num:' ', score: , qq:'', school:'', dept:'', sign,' ', enroll_year:'',//入學(xué)時(shí)間 home_area:' ', home_city:'', home_province:' ', birthday:' ', constellation:' ', hobbies: ' ', image: ' ' , } -
返回
{ uid: , token:'', }
獲取用戶權(quán)限手機(jī)號(hào)是否公開(kāi),收藏是否公開(kāi)
url:
/v1.0/users/authority/{{uid}}/{{token}}/methed:
get-
返回
{ phone_pub:, coll_pub: }
修改用戶權(quán)限手機(jī)號(hào)是否公開(kāi),收藏是否公開(kāi)
url:
/v1.0/users/authority/{{uid}}/{{token}}methed:
put-
參數(shù)
{ phone_pub: , coll_pub: } -
返回
{ state:'' , }
查看簽到信息
url:
/v1.0/sign/{{uid}}/{{token}}methed:
get-
返回
{ sign:true or false }
簽到
url:
/v1.0/sign/{{uid}}/{{token}}methed:
post-
返回
{ state:'ok' }
搜索用戶
url:
/v1.0/users/searchmethed:
post-
參數(shù)
{ 'key_word':'', ['page']: , }
獲取分類(lèi)商品
url:
/v1.0/goodsmethed:
get-
參數(shù)
{ kind:,//表示商品分類(lèi) sort_by:'',//排序方式( 'multiple','date','view','price',) [reversed]: true or false ,//如果存在則倒序排序,否則正序 page: ,//每次返回20個(gè),表示第幾個(gè)20個(gè) } -
返回
[ { gid: , name:'', views: , price: , date: '', image:'', }, ... ]
獲取商品詳情
url:
/v1.0/goods/{{gid}}methed:
get參數(shù):
none-
返回
{ gid: , name: ' ', price: , image:' ', user_info:{ uid: , username:' ', user_image: ' ', phone_num:' ', qq:' ' } school:' ', old: ' ', date:' ', content: ' ', // 描述 kind:{ kind1_name:'', kind2_name:'', } views: , }
獲取首頁(yè)最新商品
url:
/v1.0/new_goodsmethed
get-
參數(shù)
{ [page]: ,//一次返回20個(gè)商品,默認(rèn)為 1 , } -
返回
[ { gid: , name:'', price: , date: '', school: '', image: ' ', }, ... ]
搜索商品
url:
/v1.0/goods/searchmethed:
post-
參數(shù)
{ key_word: ' ', [page]: , } -
返回
{ gid: , name: , price: , image: , views: , date: ' ', }
發(fā)布商品
url:
/v1.0/goodsmethed:
post-
參數(shù)
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學(xué)校校 price: , content:'', //描述 kind: ,//分類(lèi)信息 old: '' // 新舊程度 } -
返回
{ state:'', //ok or error }
修改商品信息
url:
/v1.0/goodsmethed:
put-
參數(shù)
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學(xué)校校 price: , content:'', //描述 kind: ,//分類(lèi)信息 old: '' // 新舊程度 } -
返回
{ state:'', //ok or error [error]:'' , //error info when error }
下架貨物
url:
/v1.0/goods/{{uid}}/{{token}}/{{gid}}methed:
DELETE
- 返回
{ state:'', //ok or error [error]:'' , //error info when error }
重新上架貨物
* url: `/v1.0/goods/{{uid}}/{{token}}/{{gid}}`
* methed: `POST`
* 返回
```
{
state:'', //ok or error
[error]:'' , //error info when error
}
```
獲取分類(lèi)求購(gòu)
url:
/v1.0/wantsmethed:
get-
參數(shù)
{ kind: , sort_by:'',//'multiple','date','view','price' reversed:' ', {{page}}:' ' } -
返回
{ wid: , name:'', price: , image: , views: , date: , user_info:{ uid: , username: , image: } }
獲取求購(gòu)詳情
url:
/v1.0/wants/{{wid}}methed:
get
- 返回
{ wid: , name:' ', views: , price: , content: ' ', school:' ', user_info:{ uid: , username:' ', image:' ' }, kind_info:{ kind_name:' ' } }
獲取首頁(yè)最新求購(gòu)信息
url:
/v1.0/wants/indexmethed:
get-
參數(shù)
{ {{page}} } -
返回
[ { wid: , name:' ' , price: , views: , data:' ', school:' ', user_info:{ uid: , username: , image: ' ' } }, .... ]
搜索求購(gòu)
url:
/v1.0/wants/searchmethed:
post-
參數(shù)
{ key_word:' ', [page]: }
發(fā)布求購(gòu)信息
url:
/v1.0/wants/{{uid}}/{{token}}methed:
post-
參數(shù)
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學(xué)校校 price: , content:'', //描述 kind: ,//分類(lèi)信息 old: '' // 新舊程度 } -
返回
{ state:'', //ok or error }
修改求購(gòu)信息
url:
/v1.0/wants/{{uid}}/{{token}}methed:
put-
參數(shù)
{ uid: token:' ', name:'', image:'', school:'', //商品所屬學(xué)校校 price: , content:'', //描述 kind: ,//分類(lèi)信息 old: '' // 新舊程度 } -
返回
{ state:'', //ok or error }
刪除求購(gòu)信息
url:
/v1.0/wants/{{uid}}/{{wid}}/{{token}}methed:
delete
- 返回
{ state:'', //ok or error }
獲取當(dāng)前用戶收藏商品信息
url:
/v1.0/collections/goodsmethed:
POST-
參數(shù)
{ uid:' ', token: ' ', [page]:' ' } -
返回
{ 'user_info':{ uid:, username: '', image:' ', }, price:' ', state:' ',//狀態(tài) 商品出售中或者已經(jīng)下架 gid: ' ', date: ' ', image:' ', name:' ' }
獲取當(dāng)前用戶收藏求購(gòu)信息
* url:`/v1.0/collections/wants`
* methed:`POST`
* 參數(shù)
```
{
uid:' ',
token: ' ',
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態(tài) 商品出售中或者已經(jīng)下架
wid: ' ',
date: ' ',
name:' '
}
```
獲取制定用戶收藏商品信息
* url:`/v1.0/collections/goods/{{uid}}`
* methed:`GET`
* 參數(shù)
```
{
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態(tài) 商品出售中或者已經(jīng)下架
gid: ' ',
date: ' ',
image:' ',
name:' '
}
```
獲取指定用戶收藏求購(gòu)信息
* url:`/v1.0/collections/wants/{{uid}}`
* methed:`GET`
* 參數(shù)
```
{
[page]:' '
}
```
* 返回
```
{
'user_info':{
uid:,
username: '',
image:' ',
},
price:' ',
state:' ',//狀態(tài) 商品出售中或者已經(jīng)下架
wid: ' ',
date: ' ',
name:' '
}
```
新增商品收藏
url :
/v1.0/collections/goods/{{uid}}/{{gid}}/{{token}}methed: 'post',
-
返回
{ state:' ok', }
新增求購(gòu)收藏
url :
/v1.0/collections/wants/{{uid}}/{{gid}}/{{token}}methed: 'post',
-
返回
{ state:' ok', }
刪除商品收藏
url :
/v1.0/collections/goods/{{uid}}/{{gid}}/{{token}}methed: 'DELETE',
-
返回
{ state:' ok', }
刪除求購(gòu)收藏
url :
/v1.0/collections/wants/{{uid}}/{{gid}}/{{token}}methed: 'DELETE',
-
返回
{ state:' ok', }
獲取一級(jí)分類(lèi)分類(lèi)信息
url
/v1.0/kindsmethed:
get-
返回
{ kid: , name:' ', image:' ' }
獲取一級(jí)分類(lèi)下所有二級(jí)分類(lèi)信息
url
/v1.0/kinds/{{ l_kid }}methed:
get-
返回
{ s_kid: , name:'', image:'', }
獲取商品評(píng)論
url:
/v1.0/comments/goods/{{gid}}methed:
get參數(shù)
{
[page]
}-
返回
{ name: ' ',// 商品名 comment:' ', to_user:{ uid: , username:' ', image:' ' }, from_user:{ uid: , username: ' ', image }, gid, date:' ' }
獲取求購(gòu)評(píng)論
url:
/v1.0/comments/wants/{{wid}}methed:
get參數(shù)
{
[page]
}-
返回
{ name: ' ', comment:' ', to_user:{ uid: , username:' ', image:' ' }, from_user:{ uid: , username: ' ', image }, wid, date:' ' }
發(fā)布商品評(píng)論
url:
/v1.0/comments/goods/{{gid}}//{{uid}}/{{token}}methed:
post參數(shù)
{
'comment':' ',
}-
返回
{ 'state':'ok' }
發(fā)布求購(gòu)評(píng)論
url:
/v1.0/comments/wants/{{wid}}//{{uid}}/{{token}}methed:
post參數(shù)
{
'comment':' ',
}-
返回
{ 'state':'ok' }
發(fā)送回執(zhí)
url:
/v1.0/feedback/{{uid}}/{{token}}methed:
post-
參數(shù)
{ 'content':' ' } -
返回
{ 'state':' ' }
上傳圖片
url :
/v1.0/imagesmethed:
post-
參數(shù) (編碼格式 form-data)
{ 'image': '你的圖片', ‘uid': , 'token': , } -
返回
{ 'hash':'', 'key':' ', } 訪問(wèn)方法
7xjejh.dl1.z0.glb.clouddn.com /+ key-
圖片切割
- goods
增加參數(shù)?imageView2/1/w/800/h/800/q/75/format/JPG返回jpg格式 800*800 px 的圖片
- goods
例子
上傳圖片后KEY 為 {{key}}
則http://7xjejh.dl1.z0.glb.clouddn.com /{{key}}?imageView2/1/w/800/h/800/q/75/format/JPG
返回jpg格式 800*800 px 的圖片
舉報(bào)
url:
/v1.0/reposts/{{uid}}//{{token}}methed:
post-
參數(shù)
{ 'id': , //gid or wid 'type':' 舉報(bào)商品還是求購(gòu)'// good or want, 'content':' 舉報(bào)內(nèi)容' } -
返回
{ 'state': 'ok', }
查看用戶發(fā)布的商品
url:
/v1.0/users/goods/{{uid}}/{{token}}methed:
get-
參數(shù)
{ [page] : ', } -
返回
[ { "name": "", "views": , "price": , "gid": , "date": "", "image": " " }, ... ]
查看用戶發(fā)布的求購(gòu)
url:
/v1.0/users/wants/{{uid}}/{{token}}methed:
get-
參數(shù)
{ [page] : ', } -
返回
[ { "school": "", "wid": , "name": "", "views": , "price": , "date": " " }, ... ]