[openstreetmap/openstreetmap-website] JSON output added to changeset(s) endpoints (PR #3495)

mmd notifications at github.com
Wed Mar 9 19:39:30 UTC 2022


First draft to address missing JSON output for a number of different changeset(s) API endpoints. 

The JSON format probably still needs a bit of tweaking (happy to see to comments). Also, unit tests are still missing at this time.


Example for: http://localhost:3000/api/0.6/changesets.json?user=1

```json
{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "changesets": [
    {
      "id": 1874604,
      "created_at": "2022-02-02T17:35:00Z",
      "open": false,
      "comments_count": 0,
      "changes_count": 0,
      "closed_at": "2022-02-02T18:35:00Z",
      "uid": 1,
      "user": "mmd2",
      "tags": {
        "created_by": "JOSM/1.5 (18364)"
      }
    },
    {
      "id": 1874603,
      "created_at": "2022-01-29T14:41:11Z",
      "open": false,
      "comments_count": 0,
      "changes_count": 0,
      "closed_at": "2022-01-29T15:41:11Z",
      "uid": 1,
      "user": "mmd2",
      "tags": {
        "comment": "test",
        "created_by": "JOSM/1.5 (18364)"
      }
    }
  ]
}
```

Example for: http://localhost:3000/api/0.6/changeset/00...000.json

```json
{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "changesets": [
    {
      "id": 1874526,
      "created_at": "2020-07-25T20:47:51Z",
      "open": false,
      "comments_count": 1,
      "changes_count": 4,
      "closed_at": "2020-07-25T20:47:51Z",
      "min_lat": -4.2786786,
      "min_lon": -36.6031079,
      "max_lat": -4.2776831,
      "max_lon": -36.6021764,
      "uid": 1,
      "user": "mmd2",
      "tags": {
        "changesets_count": "1706",
        "comment": "some comment",
        "created_by": "iD 2.17.3",
        "host": "http://localhost:31900/edit",
        "imagery_used": "Bing aerial imagery",
        "locale": "en"
      }
    }
  ]
}
```

Example for: http://localhost:3000/api/0.6/changeset/1874526.json?include_discussion=true

```json
{
  "version": "0.6",
  "generator": "OpenStreetMap server",
  "copyright": "OpenStreetMap and contributors",
  "attribution": "http://www.openstreetmap.org/copyright",
  "license": "http://opendatacommons.org/licenses/odbl/1-0/",
  "changesets": [
    {
      "id": 1874526,
      "created_at": "2020-07-25T20:47:51Z",
      "open": false,
      "comments_count": 1,
      "changes_count": 4,
      "closed_at": "2020-07-25T20:47:51Z",
      "min_lat": -4.2786786,
      "min_lon": -36.6031079,
      "max_lat": -4.2776831,
      "max_lon": -36.6021764,
      "uid": 1,
      "user": "mmd2",
      "tags": {
        "changesets_count": "1706",
        "comment": "g",
        "created_by": "iD 2.17.3",
        "host": "http://localhost:31900/edit",
        "imagery_used": "Bing aerial imagery",
        "locale": "en"
      },
      "comments": [
        {
          "date": "2020-08-16T20:15:34Z",
          "uid": 1,
          "user": "mmd2",
          "text": "dfasdfasdfdfasdfasdf"
        }
      ]
    }
  ]
}
```
You can view, comment on, or merge this pull request online at:

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

-- Commit Summary --

  * JSON output added to changeset(s) endpoints

-- File Changes --

    M app/controllers/api/changeset_comments_controller.rb (16)
    M app/controllers/api/changesets_controller.rb (27)
    A app/views/api/changesets/_changeset.json.jbuilder (34)
    R app/views/api/changesets/_changeset.xml.builder (0)
    A app/views/api/changesets/changeset.json.jbuilder (5)
    R app/views/api/changesets/changeset.xml.builder (0)
    A app/views/api/changesets/changesets.json.jbuilder (5)
    R app/views/api/changesets/changesets.xml.builder (0)

-- Patch Links --

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

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

Message ID: <openstreetmap/openstreetmap-website/pull/3495 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20220309/0dae1edb/attachment-0001.htm>


More information about the rails-dev mailing list