diff options
Diffstat (limited to 'docs/access_api.rst')
-rw-r--r-- | docs/access_api.rst | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/docs/access_api.rst b/docs/access_api.rst index df69da8b2..1e19ea71b 100644 --- a/docs/access_api.rst +++ b/docs/access_api.rst @@ -13,12 +13,12 @@ First of all, you need to know what you can do with our API. It lets you do all retrieving download status, manage queue, manage accounts, modify config and so on. This document is not intended to explain every function in detail, for a complete listing -see :class:`Api <module.Api.Api>`. +see :class:`Api <pyload.Api.Api>`. -Of course its possible to access the ``core.api`` attribute in plugins and hooks, but much more +Of course its possible to access the ``core.api`` attribute in plugins and addons, but much more interesting is the possibillity to call function from different programs written in many different languages. -pyLoad uses thrift as backend and provides its :class:`Api <module.Api.Api>` as service. +pyLoad uses thrift as backend and provides its :class:`Api <pyload.Api.Api>` as service. More information about thrift can be found here http://wiki.apache.org/thrift/. @@ -26,7 +26,7 @@ Using Thrift ------------ Every thrift service has to define all data structures and declare every method which should be usable via rpc. -This file is located :file:`module/remote/thriftbackend/pyload.thrift`, its very helpful to inform about +This file is located :file:`pyload/remote/thriftbackend/pyload.thrift`, its very helpful to inform about arguments and detailed structure of return types. However it does not contain any information about what the functions does. Assuming you want to use the API in any other language than python than check if it is @@ -48,11 +48,11 @@ In case you want to use python, pyload has already all files included to access A basic script that prints out some information: :: - from module.remote.thriftbackend.ThriftClient import ThriftClient, WrongLogin + from pyload.remote.thriftbackend.ThriftClient import ThriftClient, WrongLogin try: client = ThriftClient(host="127.0.0.1", port=7227, user="User", password="yourpw") - except: + except Exception: print "Login was wrong" exit() @@ -92,14 +92,14 @@ so pyLoad can authenticate you. Calling Methods =============== -In general you can use any method listed at the :class:`Api <module.Api.Api>` documentation, which is also available to +In general you can use any method listed at the :class:`Api <pyload.Api.Api>` documentation, which is also available to the thriftbackend. Access works simply via ``http://pyload-core/api/methodName``, where ``pyload-core`` is the ip address or hostname including the webinterface port. By default on local access this would be `localhost:8000`. The return value will be formatted in JSON, complex data types as dictionaries. -As mentionted above for a documentation about the return types look at the thrift specification file :file:`module/remote/thriftbackend/pyload.thrift`. +As mentionted above for a documentation about the return types look at the thrift specification file :file:`pyload/remote/thriftbackend/pyload.thrift`. ================== Passing parameters @@ -107,7 +107,7 @@ Passing parameters To pass arguments you have two choices. Either use positional arguments, eg ``http://pyload-core/api/getFileData/1``, where 1 is the FileID, or use keyword arguments -supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <module.Api.Api>` +supplied via GET or POST ``http://pyload-core/api/getFileData?fid=1``. You can find the argument names in the :class:`Api <pyload.Api.Api>` documentation. It is important that *all* arguments are in JSON format. So ``http://pyload-core/api/getFileData/1`` is valid because @@ -118,4 +118,4 @@ Strings are wrapped in double qoutes, because `"username"` represents a string i every container type like lists and dicts are possible. You usually don't have to convert them. just use a json encoder before using them in the HTTP request. -Please note that the data have to be urlencoded at last. (Most libaries will do that automatically)
\ No newline at end of file +Please note that the data have to be urlencoded at last. (Most libaries will do that automatically) |