You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k4ever/k4ever/docs/django/api.rst

138 lines
4.0 KiB

API
===
- explain a bit how piston/REST works
- how to access the read/write/put/create functions
- what this api does and what not
k4evers API
Authentication
--------------
- how does authentication work
- what is the plugin authentication
- when does a plugin need an user?
- how to change user names
URLs
----
For more information about a specific method you can click on the url/method to get
to the handler or the responsible method for more documentation or code.
**buyable/**
:class:`item/[itemId]/ <api2.handlers.BuyableItemHandler>`
:func:`GET <api2.handlers.BuyableItemHandler.read>`
Get a specific item or a full/type item list.
========= =======================
Parameter Description
========= =======================
type item belonging to type-group
barcode item with this barcode
========= =======================
:func:`POST <api2.handlers.BuyableItemHandler.create>`
Buy a :class:`Buyable <buyable.models.Buyable>` (requires an ItemId)
========= =======================================================
Parameter Description
========= =======================================================
deposit Set to > 0 if you want to buy with deposit (default 0)
amount amount of items to buy (default 1)
========= =======================================================
:class:`types/ <api2.handlers.BuyableTypeHandler>`
:func:`GET <api2.handlers.BuyableTypeHandler.read>`
List all types which an item can belong to
:class:`history/ <api2.handlers.HistoryHandler>`
:func:`GET <api2.handlers.HistoryHandler.read>`
List the users last orders
========= =================
Parameter Description
========= =================
num Number of entries
========= =================
**account/**
**transactions/** or **transfers/**
:class:`transact/ or transfer/ <api2.handlers.TransactionTransactHandler>`
:func:`GET <api2.handlers.TransactionTransactHandler.read>`
List the users last transactions
========= =================
Parameter Description
========= =================
num Number of entries
========= =================
:func:`POST <api2.handlers.TransactionTransactHandler.create>`
Transact money to an account
========= =================
Parameter Description
========= =================
amount [required] Amount to add to the users account
type [required] Type of transaction (id)
========= =================
:class:`types/ <api2.handlers.TransactionTypeHandler>`
:func:`GET <api2.handlers.TransactionTypeHandler.read>`
List all available :class:`Transaction Types <buyable.models.TransactionType>`
:class:`balance/ <api2.handlers.AccountBalanceHandler>`
:func:`GET <api2.handlers.AccountBalanceHandler.read>`
Get users account balance
**auth/**
:class:`blob/ <api2.handlers.AuthBlobHandler>`
:func:`GET <api2.handlers.AuthBlobHandler.read>`
Return authblob if allowed or auth if str given
(currentyl only allowed for Plugin users)
========= =================
Parameter Description
========= =================
blob blob to get user from / auth user with, returns User or NULL
========= =================
:func:`POST <api2.handlers.AuthBlobHandler.create>`
Set authblob if allowed
:class:`user/ <api2.handlers.AuthUserHandler>`
:func:`GET <api2.handlers.AuthUserHandler.read>`
get user by authblob string - this function works only when plugin
has the :attr:`unique authblob <main.models.Plugin.uniqueAuthblob>` flag set
========= =================
Parameter Description
========= =================
authblob [required] authblob to sear
========= =================
:class:`config/ <api2.handlers.ConfigHandler>`
:func:`GET <api2.handlers.ConfigHandler.read>`
Display API configuration variables
Handler
-------
.. automodule:: api2.handlers
:members:
Examples
--------
- how to use the api
- examples with... wget.. python-rest?
As normal user
^^^^^^^^^^^^^^
.. note:: there will be cat content
wget
""""
wget part
As a plugin
^^^^^^^^^^^