title: Getting POST parameters on both, form and json format
body: <p>My webservice should receive calls in these two formats: <strong>application/x-www-form-urlencoded</strong> and <strong>content-type application/json</strong>.</p>
  
  <p>The code below works correctly for the forms. However, it doesn't work for the json ones. Apparently I need to use <code>request.args.get</code> for it.</p>
  
  <p>Is there a way to modify the code so that the same method can receive calls in these two formats?</p>
  
  <pre><code>@app.route("/api/&lt;projectTitle&gt;/&lt;path:urlSuffix&gt;", methods=['POST'])
  def projectTitlePage(projectTitle, urlSuffix):
  
      apiKey = request.form.get('apikey')
      userId = databaseFunctions.getApiKeyUserId(apiKey)
      userInfo = databaseFunctions.getUserInfo(userId)
      projectId = databaseFunctions.getTitleProjectId(projectTitle)
      projectInfo = databaseFunctions.getProjectInfo(projectId)
      databaseFunctions.addUserHit(userId, projectId)
      databaseFunctions.addProjectHit(userId)
  
      print request.form.to_dict(flat=False)
      try:
          r = requests.post(projectInfo['secretUrl'], data=request.form.to_dict(flat=False))
      except Exception, e:
          return '/error=Error'
  
      return r.text
  </code></pre>