Python Bottle how to pass parameter as json
Question: I created an api for openerp using bottle

It works well while access using browser

I don't know how to pass it as json parameters

The Problem is

how can i call using api and pass json parameters like

    
    
    http://localhost/api?name=admin&password=admin&submit=Submit
    

Here is my wsgi code app.wsgi

    
    
    import json
    import os
    import sys
    import bottle
    from bottle import get, post, run,request,error,route,template,validate,debug
    def login():
            import xmlrpclib
            username = request.forms.get('name')
            pwd = request.forms.get('password')
            dbname = 'more'
            sock_common = xmlrpclib.ServerProxy ('http://localhost:8069/xmlrpc/common')
            uid = sock_common.login(dbname, username, pwd)
            if uid:
                    return json.dumps({'Success' : 'Login Sucessful'])
    
    def index():
            return '''
            <html>
            <head>
                    <title> Portal</title>
            </head>
            <body>Welcome To PORTAL
       <form method="GET" action="/api/links" enctype="multipart/form-data">
       Name:<input name="name" type="text"/><br>
       Password:<input name="password" type="password"/><br>
       <input type="submit" value="Submit" name="submit">
       </form>
       </body>
       </html>'''
    
    def links():
            return '''
            <html>
            <head>
                    <title> Portal</title>
            </head>
            <body>
        <a href="/api/advisor">Advisor<br>
       </body>
       </html>'''
    
    application = bottle.default_app()
    application.route('/', method="GET", callback=index)
    application.route('/', method="POST",callback=login)
    


Answer: [`request.forms`](http://bottlepy.org/docs/dev/api.html#bottle.BaseRequest.forms)
is used for POST or PUT requests. The form in your code uses GET, not POST, so
you should use
[`request.query.getall`](http://bottlepy.org/docs/dev/api.html#bottle.BaseRequest.query),
which gives you access to "URL arguments".

