店铺用户的 Bannber
金色童年
NOTE
店铺用户与普通用户的区别是:店铺用户的分组是: shop_user
新建一个banner
Method and URL Structure
只能创建 shop-user 类型的 bannber
Method |
Resource URL |
POST |
/news/banners/create/ |
Request Paramaters
Name |
Description |
Required |
Defalut |
title |
标题 |
YES |
|
link |
链接 |
YES |
|
banner_url |
图片地址 |
YES |
|
banner_type |
类型 |
YES |
|
cURL Example
curl -X POST -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/new/bannber/create/
Reponse
{
"pk":1,
"title":"可怜无定河边骨,犹是春闺梦里人。",
"desc":"可怜无定河边骨,犹是春闺梦里人。",
"link":"http://link.example.com",
"banner_url":"http://img.example.com/1.png",
"banner_type":"shop-user"
}
更新、获取一个 bannber 信息
Method |
Resource URL |
Description |
GET |
/news/banner/${banner pk}/ |
获取 |
PUT |
/news/banner/${banner pk}/ |
整体更新 |
PATCH |
/news/banner/${banner pk}/ |
部分更新 |
Request Paramaters
只能是 shop-user 类型
Name |
Description |
Required |
Defalut |
title |
标题 |
YES |
|
link |
链接 |
YES |
|
banner_url |
图片地址 |
YES |
|
banner_type |
类型 |
YES |
|
cURL Example
curl -X PUT -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\
-H 'Content-Type: Application/json' --data '{....}' http://localhost/new/bannber/1/
Response
{
"pk":6,
"title":"儿童散学归来早,忙趁东风放纸鸢。",
"desc":"儿童散学归来早,忙趁东风放纸鸢。",
"link":"http://link.example.com/example_link.html",
"banner_url":"http://img.example.com/test001.png",
"banner_type":"shop-user"
}
获取店铺用户 banner 列表
Method and URL Structure
Method |
Resource URL |
GET |
/news/shop_banners/${shop user pk} |
Request Paramaters
Name |
Description |
Required |
Defalut |
page |
页码 |
NO |
1 |
page_size |
每页条目 |
NO |
10 |
cURL Example
curl -H 'Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b'\ http://localhost/news/shop_banners/1234/?page=3&page_size=8
Response
{
"count":2,
"next":null,
"previous":null,
"results":[{
"pk":7,
"title":"儿童散学归来早,忙趁东风放纸鸢。",
"desc":"儿童散学归来早,忙趁东风放纸鸢。",
"link":"http://link.example.com/example_link.html",
"banner_url":"http://img.example.com/test001.png",
"banner_type":"shop-user"
},{
"pk":6,
"title":"晋阳已陷休回顾,更请君王猎一围。",
"desc":"晋阳已陷休回顾,更请君王猎一围。",
"link":"http://link.example.com/link.html",
"banner_url":"http://img.example.com/3.png",
"banner_type":"shop-user"
}]
}