[openstreetmap/openstreetmap-website] Note update date in xml, json, rss api output formats (PR #3578)

Anton Khorev notifications at github.com
Mon Jun 20 11:40:49 UTC 2022


Adds `update_date` to notes api output.

Internally, notes have updated_at, created_at and closed_at dates. Create and close dates are available through the api, update date is not. Usually you can look at the date of the last note comment to figure out update_date. Except it's not always possible. If the last comment is hidden the date is going to be incorrect.

Why do you need update date? Note search results can be sorted by update date. The number of returned notes is limited, the default limit is 100. What if you want to get the next 100 notes? You can add a `from` or `to` parameter to your search call with the date of a last note you got as a value.* That way you can skip the first 100 notes you already received.**

I named the added key/element `update_date`, similar to existing `date_created` and `date_closed` keys/elements, if we ignore one naming inconsistency in json where `closed_at` is used instead of `date_closed`. I didn't add update date to rss, because there's no good possible element inside `<item>` for it.

\* actually date + 1 second for `to`
\** except for same-second notes
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/3578

-- Commit Summary --

  * Note update date in xml, json, rss api output formats

-- File Changes --

    M app/views/api/notes/_note.gpx.builder (1)
    M app/views/api/notes/_note.json.jbuilder (1)
    M app/views/api/notes/_note.xml.builder (1)
    M test/controllers/api/notes_controller_test.rb (4)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/3578.patch
https://github.com/openstreetmap/openstreetmap-website/pull/3578.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/3578
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/3578 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220620/c767cdbb/attachment.htm>


More information about the rails-dev mailing list