dgtlmoon / changedetection.io

The best and simplest free open source web page change detection, website watcher, restock monitor and notification service. Restock Monitor, change detection. Designed for simplicity - Simply monitor which websites had a text change for free. Free Open source web page change detection, Website defacement monitoring, Price change notification
https://changedetection.io
Apache License 2.0
16.85k stars 941 forks source link

[feature] API - Unique check when adding a URL #1571

Open dgtlmoon opened 1 year ago

dgtlmoon commented 1 year ago

Discussed in https://github.com/dgtlmoon/changedetection.io/discussions/1567

Originally posted by **Jomiph** May 12, 2023 I hope I'm not doing things wrong, but I noticed, if you try to add a url via the web interface, it will tell you if it already exists in the watch list. But, when adding via the api, there seems to not be such a check, and it adds with a new uuid. Am I missing something, or is there a way to have it check if the url exists? I guess I can work around it by pulling the watch list and comparing against it, but wanted to see if there was a built-in way of doing this.

Good question - I think the answer is that we should add something like uniq=true to the request

curl http://localhost:4000/api/v1/watch?uniq=true -H"x-api-key:xxxx" -H "Content-Type: application/json" -d '{"url": "https://my-nice.com" , "tag": "nice list"}'

See https://github.com/dgtlmoon/changedetection.io/issues/1571

@Jomiph which API call are you using exactly?

Noki commented 5 months ago

@dgtlmoon I think after (https://github.com/dgtlmoon/changedetection.io/commit/895c443110ff5bf83d1590bed674cf93260168f1) this one can be closed now.