1
0
mirror of https://github.com/aquatix/digimarks.git synced 2025-12-06 22:05:09 +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>')
def bookmark_json(userkey, urlhash):
""" Serialise bookmark to json """
bookmark = Bookmark.select(
Bookmark.url_hash == urlhash,
Bookmark.userkey == userkey,
Bookmark.status == Bookmark.VISIBLE
)[0]
return jsonify(bookmark.to_dict())
try:
bookmark = Bookmark.get(
Bookmark.url_hash == urlhash,
Bookmark.userkey == userkey,
Bookmark.status == Bookmark.VISIBLE
)
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>')