1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 20:55:10 +01:00

Fixed API endpoint for single bookmark lookup

This commit is contained in:
2018-03-26 15:11:07 +02:00
parent 718b39a267
commit 6f9d44ce86

View File

@@ -618,12 +618,15 @@ def bookmarks_json(userkey, filtermethod=None, sortmethod=None):
@app.route('/api/v1/<userkey>/<urlhash>') @app.route('/api/v1/<userkey>/<urlhash>')
def bookmark_json(userkey, urlhash): def bookmark_json(userkey, urlhash):
""" Serialise bookmark to json """ """ Serialise bookmark to json """
bookmark = Bookmark.select( try:
Bookmark.url_hash == urlhash, bookmark = Bookmark.get(
Bookmark.userkey == userkey, Bookmark.url_hash == urlhash,
Bookmark.status == Bookmark.VISIBLE Bookmark.userkey == userkey,
)[0] Bookmark.status == Bookmark.VISIBLE
return jsonify(bookmark.to_dict()) )
return jsonify(bookmark.to_dict())
except Bookmark.DoesNotExist:
return jsonify({'message': 'Bookmark not found', 'status': 'error 404'})
@app.route('/api/v1/<userkey>/search/<filter_text>') @app.route('/api/v1/<userkey>/search/<filter_text>')