parameters: (request, sheet_id)
return_statement: return jsonResponse(update_sheet_topics(int(sheet_id), topics, old_topics))
docstring: API to update tags for sheet_id.
docstring_summary: API to update tags for sheet_id.
docstring_tokens: API to update tags for sheet_id .
function: def update_sheet_topics_api(request, sheet_id):
      """
      API to update tags for sheet_id.
      """
      topics = json.loads(request.POST.get("topics"))
      sheet = db.sheets.find_one({"id": int(sheet_id)}, {"topics":1})
      if sheet["owner"] != request.user.id:
          return jsonResponse({"error": "user can only add topics to their own sheet"})
      old_topics = sheet.get("topics", [])
      return jsonResponse(update_sheet_topics(int(sheet_id), topics, old_topics))
function_tokens: def update_sheet_topics_api ( request , sheet_id ) : topics = json . loads ( request . POST . get ( "topics" ) ) sheet = db . sheets . find_one ( { "id" : int ( sheet_id ) } , { "topics" : 1 } ) if sheet [ "owner" ] != request . user . id : return jsonResponse ( { "error" : "user can only add topics to their own sheet" } ) old_topics = sheet . get ( "topics" , [ ] ) return jsonResponse ( update_sheet_topics ( int ( sheet_id ) , topics , old_topics ) )