django-s-store-api is a simple store rest api of django.
Project description
django-s-store-api
django-s-store-api is a simple store rest api of django.
Installation
To install django-s-store-api like this:
pip install django-s-store-api
Configuration
We need to hook django-s-store-api into our project.
-
Put s_store_api into your INSTALLED_APPS at settings module:
INSTALLED_APPS = ( ..., 's_store_api', )
-
Create s_store_api database table by running:
python manage.py migrate
-
Add url patterns at project.urls module:
from s_store_api import urls as s_store_api_urls urlpatterns = [ ..., path(r'api/stores/', include(s_store_api_urls)) ]
API
List stores
Show list stores which are allowed to access by login user.
method: GET
url: /api/stores/
name: s-stores:stores-list
view: StoreViewSet
Detail store
Show detail of target store.
Show detail with store items, if items parameter is true.
method: GET
url: /api/stores/<pk>/[?items=true]
name: s-stores:stores-detail
view: StoreViewSet
Open store
Open your store.
Invite user to allow access store, when set true at is_limited_access
method: POST
url: /api/stores/
parameters:
{
'name': 'store name',
'is_limited_access': True
}
name: s-stores:stores-list
view: StoreViewSet
Close store
Close your store.
method: DELETE
url: /api/stores/<pk>/
name: s-stores:stores-detail
view: StoreViewSet
Update store's info
Update your store's information
method: PUT/PATCH
url: /api/stores/<pk>/
parameters:
{
'name': 'changed store name',
'is_limited_access': False
}
name: s-stores:stores-detail
view: StoreViewSet
Hire staff
Hire staff.
method: PUT
url: /api/stores/<pk>/hire_staff/
parameters:
{
'staff': 2 (user's id)
}
name: s-stores:stores-hire-staff
view: StoreViewSet
Dismiss staff
Dismiss staff.
method: PUT
url: /api/stores/<pk>/dismiss_staff/
parameters:
{
'staff': 2 (user's id)
}
name: s-stores:stores-dismiss-staff
view: StoreViewSet
Invite user
Invite user to limited access store
Request parameter's format should be json.
method: PUT
url: /api/stores/<pk>/invite_user_to_limited_access/
parameters:
{
'users': [
2 (user's id),
4
]
}
name: s-stores:stores-invite-user-to-limited-access
view: StoreViewSet
List items
List items at store
method: GET
url: /api/stores/<store>/items/
name: s-stores:items-list
view: ItemViewSet
Detail item
Detail item at store
method: GET
url: /api/stores/<store>/items/<pk>/
name: s-stores:items-detail
view: ItemViewSet
Buy item
Buy item from store. You received item in bag and receipt.
method: POST
url: /api/stores/<store>/items/{pk}/buy/
parameters:
{
'price': 2 (item.price.pk)
}
name: s-stores:items-buy
view: ItemViewSet
Sell item
Sell item to store. Request parameter's format should be json.
method: POST
url: /api/stores/<store>/items/
parameters:
{
'name': 'new_item',
'prices_set': [
{'coin_id': 2 (coin.pk), 'value': 100},
{'coin_id': 3 (coin.pk), 'value': 10},
]
}
name: stores:items-list
view: ItemViewSet
Set prices
Set prices to exists item. Request parameter's format should be json.
method: POST
url: /api/stores/items/<item>/prices
parameters:
[
{'coin_id': 4 (coin.pk), 'value': 1000},
{'coin_id': 5 (coin.pk), 'value': 11},
]
name: s-stores:prices-list
view: PriceViewSet
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_s_store_api-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 511237482fecee002893cd2f512da4f0a9f5189d110b021a25123850069df737 |
|
MD5 | a4ef08ea378160490ab3e3941507008a |
|
BLAKE2b-256 | 672b6d2c56c606aa4361deec318eebd89c917c2571ddff8efeca24724854c22c |