Dacid99 / LinkDroid-for-Linkwarden

Mirror repository of the LinkDroid for Linkwarden app
https://gitlab.com/Dacid99/linkdroid-for-linkwarden
Other
34 stars 3 forks source link

please help: API you use, examples #8

Closed posta246 closed 6 days ago

posta246 commented 6 days ago

Hi Dacid99, sorry me if I disturb you here, I'm trying to make a bash script to load into linkwarden one or more link I save here and there. Might you help me with the curl command to send to linkwarden istance? API are not clear to me. I ask you I image you use them for the app (that is great!!!). I wuold like to use something like: curl -H "Authorization: Bearer <MY_TOKEN>" https://linkwarden.my_domain.tld/api/v1/<MY_LINK> Can you help me? Thanks a lot!

Dacid99 commented 6 days ago

Hi, Im always happy to help! First of all I can warmly recommend the Linkwarden API docs. The url you want to POST to is https://linkwarden.my_domain.tld/api/v1/links. The data has to be formatted correctly which is not easy to figure out.

Example for a curl command:

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer "" -d '{"url": "", "name": "", "description": "", "tags":[{"name":""}, ...], "collection":{"name":""}}' https://yourlinkwarden.tld/api/v1/links

Hope this solves your problem!

posta246 commented 6 days ago

Thanks a lot, it works, this is the full command that included the use of variables, if someone read it in the future: #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.your_domain.tld/api/v1/links

posta246 commented 6 days ago

useful link https://www.bboy.app/2024/03/20/setting-up-and-using-linkwarden/