code: def update(uid=None):
      
      app.logger.info("PUT /sync route with id: %s" % uid)
  
      try:
          user = Participant.query.\
              filter(Participant.uniqueid == uid).\
              one()
      except exc.SQLAlchemyError:
          app.logger.error("DB error: Unique user not found.")
  
      if hasattr(request, 'json'):
          user.datastring = request.data.decode('utf-8').encode(
              'ascii', 'xmlcharrefreplace'
          )
          db_session.add(user)
          db_session.commit()
  
      try:
          data = json.loads(user.datastring)
      except:
          data = {}
  
      trial = data.get("currenttrial", None)
      app.logger.info("saved data for %s (current trial: %s)", uid, trial)
      resp = {"status": "user data saved"}
      return jsonify(**resp)
docs: Save experiment data, which should be a JSON object and will be stored
      after converting to string.