title: How to update the database using sqlform through a service call
body: <p>I wanted to know how to update the database using sqlform through a service call. for example</p>
  
  <p>db.py contains</p>
  
  <pre><code>db.define_table('person',
  Field('name'),
  Field('email'))
  </code></pre>
  
  <p>controller contains</p>
  
  <pre><code>@service.run
  def display_form():
  form = SQLFORM(db.person)
  if form.accepts(request.vars):
      return "success"
  else:
      return "failure"
  </code></pre>
  
  <p>The http post variable is sent as data = {"name":"xyz", "email":"xyz@gmail.com"}</p>
  
  <p>I would like to know whether I am sending the post variables correctly. I always get the failure message. WHY IS THE DB NOT GETTING UPDATED. Actually I would like to do this with form = auth.register(). I need to enter the auth table values through a service call. but this is long way to go. </p>
  
  <h2>Update</h2>
  
  <p>This is the way I am posting. </p>
  
  <pre><code>url = "http://example.com/myapp/mycontroller/api/person"
  data = {"name":"peter","email":"peter@gmail.com"}
  datatosend = urllib.urlencode(data)
  request = urllib2.Request(url,datatosend)
  res = urllib2.urlopen(req)
  </code></pre>
  
  <p>but the POST method in api is not seeing the person at all. </p>