sissbruecker / linkding

Self-hosted bookmark manager that is designed be to be minimal, fast, and easy to set up using Docker.
https://linkding.link/
MIT License
6.82k stars 326 forks source link

[Feature Request] API: query/extract data by date #899

Open posta246 opened 1 month ago

posta246 commented 1 month ago

Hi, I'm playing a little with the API but I miss the feature to extract only the bookmark add/modified in a specific date time. This is very useful if you have to syncronize with other tools (that, usually, is one of the APIs purpose) and need to know what data you have exchanged. With "date" parameter, I can extract only the bookmarks of the day - the new ones or the daily ones modified - and manage them. Thanks for reading!

posta246 commented 3 weeks ago

ok, if someone need to daily extract linkding bookmarks and add them to linkwarden (that makes pdf...) I wrote this script to be adapted:


LINKWARDEN_TOKEN="the_token"
BOOKMARKS=$(curl -s -H "Authorization: Token LINKDING_TOKEN" https://LINKDING_IP:PORT/api/bookmarks/?limit=100 | jq --arg date $(date +%Y-%m-%d) '.results | .[] | select(.date_added>=$date) | .url' | sed 's/"//g')

for BOOKMARK in $BOOKMARKS;
do
  echo -e Adding "$BOOKMARK" ...
  curl -s -X POST \
       -H "Content-Type: application/json" \
       -H "Authorization: Bearer $LINKWARDEN_TOKEN" \
       -d '{"url":"'$BOOKMARK'","description":"","type":"url","tags":[],"preview":"","image":"","pdf":"","readable":"","textContent":"","collection":{"id":1}}' \
       https://LINKWARDEN_IP:PORT/api/v1/links
done