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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-s-store-api-1.0.0.tar.gz.
File metadata
- Download URL: django-s-store-api-1.0.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03f1cc2c16f7ba9fc72831e25208dd0e8c562d0584c036838d899f40c358d88a
|
|
| MD5 |
14fecaf48371ee9da34505aa5bb03b10
|
|
| BLAKE2b-256 |
387418773bbe8772da038cf2e3235c61774e711ff018c52b4d62381e0e8c2ec0
|
File details
Details for the file django_s_store_api-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_s_store_api-1.0.0-py3-none-any.whl
- Upload date:
- Size: 33.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.41.0 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
511237482fecee002893cd2f512da4f0a9f5189d110b021a25123850069df737
|
|
| MD5 |
a4ef08ea378160490ab3e3941507008a
|
|
| BLAKE2b-256 |
672b6d2c56c606aa4361deec318eebd89c917c2571ddff8efeca24724854c22c
|