How can I distinguish deleted and not yet existing notes?

Is there some good way to obtain id of latest created note?

Or to check whether specific note is deleted or not yet existing? Currently both return Request failed: 404 - Not Found (this used to be different, not anymore)

For example, https://www.openstreetmap.org/note/3881941 existed but was hidden/deleted.

https://www.openstreetmap.org/note/3881941000 is not yet existing

Note: 3881955 | OpenStreetMap exists and is visible

Why it is useful: I have script that watches created notes, detects obvious vandalism notes and closes them. I run it when some anonymous note vandal becomes active. I wanted to reenable it and discovered that it now fails as response for not-yet-existing and used-to-be-existing notes is now the same.

Never used it but https://api.openstreetmap.org/api/0.6/notes/search?from=<now>&order=newest&limit=5 (replace <now> with a valid timestamp like 20230911T062100Z) should give you the latest ID as first entry.

https://api.openstreetmap.org/api/0.6/notes/search?sort=created_at&order=newest&closed=-1&limit=1

you need sort=created_at, otherwisr its the last updated note

technically you also need closed=-1 for some very unlikely situation when the latest note happens to be closed for longer than one week

these queries shouldn’t cause big load, there’s an index by date, and you’re selecting the topmost entry in the index

Go to note-viewer , check “advanced mode” and you’ll be able to see urls of note search queries.

And of course all searches ignore hidden notes but:

  • it’s very unlikely that the latest note is already hidden
  • if you’re running a script continuously, just remember the previous note id; if it goes down, assume that the previous id is the latest one