gnowledge/gstudio — pull request #944 by sunnychaudhari (2014-12-15 19:10:30+00:00)
Title: Implemented "django-json-rpc" for fetching resource & its metadata.

As per the requirement for creating API to fetch the resources with its metadata, we have decided to go ahead with "**django-json-rpc**" , anyone can make use this API to get the resources information in their project, which are uploaded in all our metastudio platforms

**Feature Enhancement**

* Implemented basic API for getting the resources and its metadata using browser url as well as from calling a method through shell

* ```__init__.py``` --> two urls added for json-rpc method, one for graphical json-rpc browser and web console and other is with the included ServiceProxy (which is "Proxy to test your JSON Service")

* ```settings.py``` --> Included 'jsonrpc' in INSTALLED_APPS in settings.

* ```rpc_resources.py``` --> json rpc method "resources()" implemented in this view file. Wil use this method in more generic way as and when required.

* Follow the steps for testing this implementation:
* **Install django-json-rpc**:

* go till **/manage.py** directory and do : **git clone git://github.com/samuraisam/django-json-rpc.git**

* then go inside the django-json-rpc directory ```cd django-json-rpc``` and run **python setup.py install**

* **Now two ways of testing**
* First of all run project ```python manage.py runserver```
* Now open another tab and go to shell ```python manage.py shell``` and run following commands:

--> from jsonrpc.proxy import ServiceProxy
--> s = ServiceProxy('http://localhost:8000/json/')
--> s.resources()

This will return all public resources along with its metadata as a value in json format.

* Second way is from browser url for graphical json-rpc browser and web console
--> Hit this url in browser ```http://127.0.0.1:8000/json/browse/```
This will open the "JSON-RPC Browser", in which you can see the method which is being called which is listed in methods section. when you click on that method "resources()" , it will show you the related information of this jsonrpc , such as "signature", "argument", "returns","idempotent",....and so on

--> Call the method in that console as : **jsonrpc.resources()**
Which will show you the requesting json as :
{"id":"jsonrpc", "params":[], "method":"resources", "jsonrpc":"1.0"}
and returned response (as Got -->) of all resources with its metadata in json format.