API Document
all API please set application-type json in body
test user(set password)
id:tanaka1(loginid)
pass:tanakanopass
superuser(/admin)
id:super
pass:super
User
✅create
endpoint /api/users/create/
method POST
params
code:json/create_user_input_example
{
"loginid": "tanaka",
"password": "tanakatanaka",
"username": "t-naka",
"firstname": "tanaka",
"lastname": "keisuke",
"iconimage": null,
"birthday": "1997-08-02",
"zipcode": "111-2345",
"address": "東京都xx区〇〇",
"is_recommend": false,
}
✅get (all, by loginid, by loginid)
include nested info(friends, tags, wishlists)
endpoint /api/users/(全件取得)
クエリパラメータの指定も可能
/api/users/?userid=tanaka
/api/users/(loginid)/(個別に取得)
no parameter is needed
response example
code:json
{
"loginid": "satou",
"username": "satoh",
"firstname": "syunnsuke",
"lastname": "satoh",
"iconimage": null,
"birthday": "1997-02-07",
"zipcode": "1111111",
"address": "aiaiaii",
"is_recommend": false,
"friends": [
{
"id": "00000000-0000-0000-0000-000000000001",
"loginid": "tanaka1",
"username": "tanaka1",
"birthday": "1995-01-01",
"friends": [
"00000000-0000-0000-0000-000000000002",
"00000000-0000-0000-0000-000000000004"
]
},
{
"id": "00000000-0000-0000-0000-000000000003",
"loginid": "watanabe1",
"username": "watanabe1",
"birthday": "1996-01-01",
"friends": []
}
],
"tags": [
{
"id": 1,
"name": "レディースファッション"
},
{
"id": 5,
"name": "靴"
}
],
"wishlists": [
{
"id": 4,
"name": "pokemon card",
"user_id": "224d8c8c-f61f-4ccf-a24b-719a3987d876",
"products": [
{
"id": 1,
"name": "シャイニースターV",
"url": "pokemon.com",
"tag"????
},
]
}
]
}
✅create/delete friend relation
method POST / DELETE
endpoint /api/users/(loginid)/friend/
body param "friendid":[(loginid), ...] ex "friendid":["tanaka1", "watanabe1"]
return httpstatus (create->201, delete->204)
✅create/delete tag relation
method POST / DELETE
endpoint /api/users/(loginid)/tag/
body param "tagid":[(loginid), ...] ex "tagid":[1, 2]
return httpstatus (create->201, delete->204)
✅delete wishlist
not create API. When you create a wishlist, users are automatically associated with it.
method DELETE
endpoint /api/users/(loginid)/wishlist/
body param "wishlistid":[(wishlistのid), ...] ex "wishlistid": [1]
return 204 (別のレスポンス番号の方がいいかも)
loginしてるユーザーを返す
method GET
endpoint /api/loginuser
return loginid
Product
✅get
show all products
method GET
endpoint /api/products/
no params
response
code:json:/product_get_api
[
{
"id": 1,
"name": "シャイニースターV",
"tags": [
{
"id": 9,
"name": "おもちゃ"
}
],
"url": "rakutenichi link",
"urlimage": "jpgのリンク",
"price": 5500.
},
✅ get from tag (preferencetag から一致する商品の表示) (クエリパラメータでtag id指定)
method GET
queryparam tagid (数字)
endpoint (ex. tagid=2の商品を検索するとき)/api/products/?tag=2
✅create
create products
method POST
endpoint /api/products/create/
body param {"name" : "コーヒー", "tag_id":[1, 3, 5], "urlimage":"xxxxx.jpg","url" : "coffee.com", "price", "12300"
作成したproductを返す
⬜update
⬜delete
Wishlist(create, read, (update), delete)
✅ Get(all, by id)
ユーザーid(ログインidではない), products(name, tag, price)を返す
endpoint 全件/api/wishlists/
ユーザーのウィッシュリストの表示/api/wishlists/?userid=(userのloginid)
(wishlistid毎に個別表示,使わない/api/wishlists/(wishlists id)/)
code:json
[
{
"id": 4,
"name": "コーヒーの日に",
"user_id": "00000000-0000-0000-0000-000000000001",
"products": [
{
"id": 1,
"name": "大福",
"tags": [
{
"id": 1,
"name": "レディースファッション"
},
],
"url": "akafukulcom",
"price": null
},
{
"id": 2,
"name": "Nintendo Switch",
"tags": [
{
"id": 2,
"name": "メンズファッション"
},
],
"url": "nintendo_switch.com",
"price": null
}
]
}
]
✅ Create
method POST
endpoint /api/wishlists/create
エンドポイントは変更 api/wishlists/create/(loginid)
loginidで指定したユーザーに空のウィッシュリストが作られる
body param ex {"name":"コーヒーの日に", "products":[]
productの追加は↓のAPIでやるのがよさそう.
このapiは空のウィッシュリストを作成する用
✅ Create/delete relation with product
method POST
endpoint /api/wishlists/(wishlists id)/product
body param ex {"productid":[1, 2]}
Preference tags
✅Preference Tag List (GET)
idとtagを返す
method GET
endpoint api/preferencetags
Okurimono-navi api (おくりものナビ)
✅ get 季節のイベントのタイトル,説明,バナー画像(のリンク), 市場のイベントのページを返す
endpoint api/navi
response
code:json/navi-api-response-example
[
[
"敬老の日特集2021",
"敬老の日には感謝を伝えるギフトを贈ろう!いつも家族を温かく見守ってくれるおじいちゃん、おばあちゃんに。年を重ねたお父さん、お母さんに、「ありがとう」の気持ちを贈りましょう。",
],
[
"おせち特集2022",
"定番人気やレビュー高評価などのテーマから、自分にぴったりのおせちを見つけましょう。また、実家にギフトとしても!早期購入特典付きのおせちで、今年は早目にお得にお正月準備!",
]
]
ログアウト(basic認証の解除)
method GET
endpoint /api/logout
response http response 401