[openstreetmap/openstreetmap-website] Get the recently closed / reopened / commented notes (Issue #4290)
Andres Gomez Casanova
notifications at github.com
Sat Oct 14 04:30:21 UTC 2023
### Problem
The API only takes the opening time to get the notes in "[Search](https://wiki.openstreetmap.org/wiki/API_v0.6#Search_for_notes:_GET_/api/0.6/notes/search)" option, but I need to get the changes of every note (closed, commented or reopened). The API documentation on the Wiki states this:
> Returns the existing notes matching either the initial note text or any of the comments. The notes will be ordered by the date of their last change
The API Search option only returns the notes created after a given date. However, there is no option to retrieve the modifications of the notes after a given date, or the implementation of this function is not working correctly.
Let's suppose these notes:
```
t2 t1
|------------+---------+----------+-----------------+-------+------+-----+-------------> t
Note1 | | | Open |
| | | |
Note2 Open | | Comment
| |
Note3 Open Close
```
If I query the notes "from" t1 (to now), I only get Note1. But I also want to retrieve Note2 because there was a comment after t1. The only way to get the Note2 from API is to put the "from" parameter as t2 before the creation of note2, but in this case, I will also get Note3.
Let me show you a scenario on an island in Colombia called [Malpelo](https://www.openstreetmap.org/#map=14/4.0029/-81.6039).
By analysing the Planet dump, I see there are two closed notes:
* [994133](https://www.openstreetmap.org/note/994133) (Closed 12 months ago)
* Created at 2017-05-12 20:13:23
* Closed at 2022-10-17 01:28:35
* [3602820](https://www.openstreetmap.org/note/3602820) (Closed one day ago)
* Created at 2023-03-18 14:03:57
* Closed at 2023-10-13
I use the API to get the notes, and I modify the "closed" parameter with a date between the opening and close of the first note, which I chose 2021-01-01:
* closed=-1 (Error): Returns only the recently closed note but not the old note.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2021-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=-1
* closed=0 (OK): Returns nothing, which is OK. There are no open notes in the area.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2021-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=0
* closed=7 (OK): Returns the recently closed note, which is OK.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2021-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=7
* closed=5000 (Error): Returns the recently closed note but not the other, which was closed 12 months ago.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2021-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=5000
* closed=5000 changed date (OK): Returns the recently closed note but not the other, which was closed 12 months ago.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2017-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=5000
* closed=400 changed date (OK): Returns the recently closed note but not the other, which was closed 12 months ago.
* https://api.openstreetmap.org/api/0.6/notes/search.xml?from=2017-01-01T00:00:00Z&bbox=-81.761460,3.912338,-81.416420,4.085293&closed=400
### Description
The API for the Search option should include a parameter for only open notes or any operation on the notes. It only works for open notes, but the API states the other. Therefore, both options should be part of the API with an extra parameter.
### Screenshots
_No response_
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/4290
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/issues/4290 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231013/4d83c24c/attachment.htm>
More information about the rails-dev
mailing list