Skip to content

Get a list of events (comments and mutations)

gerome12 edited this page Oct 1, 2018 · 43 revisions

Used to get all comments (private and public) and all mutations about an album. For getting events, the user must be a memeber of the album.

URL : /album/{album_id}/events

Method : GET

Auth Required : Authorization with a JWT Bearer token with the user as the sub claim. The user must be a member of the album.

Headers

  • Accept : If present, require that this value be application/json

URL Parameters

  • types={comments,mutations} (Optional)
    • "comments" return all publics comments and all pivates comments with the calling user order by date.
    • "mutations" return all events about the album like : AddUser, AddAdmin, RemoveUser, PromoteAdmin, DemoteAdmin, CreateAlbum, LeaveAlbum, ImportStudy, ImportSeries, RemoveStudy, RemoveSeries, EditAlbum
  • limit={limit} (Optional)
  • offset={offset} (Optional)

Success Response

  • Status : 200 OK

Events are sorted by descending date.

[
    {
        "event_type": "Comment",
        "origin_name": "user1@domain.com",
        "comment": "second comment",
        "post_date": "2018-09-23T06:59:01",
        "is_private": true,
        "target_name": "user2@domain.com"
    },
    {
        "event_type": "Mutation",
        "origin_name": "user1@domain.com",
        "post_date": "2018-09-22T06:59:42",
        "target_name": "user2@domain.com",
        "mutation_type": "ADD_USER"
    },
    {
        "event_type": "Comment",
        "origin_name": "user1@domain.com",
        "comment": "first comment",
        "post_date": "2018-09-21T06:59:02",
        "is_private": false
    },
    {
        "event_type": "Mutation",
        "origin_name": "user1@domain.com",
        "post_date": "2018-09-20T06:58:28",
        "mutation_type": "CREATE_ALBUM"
    },
    {...}
]

The response is a JSON array of events.
Comments events can be : private or public.
Public comment :

{
    "event_type": "Comment",
    "origin_name": "user1@domain.com",
    "comment": "first comment",
    "post_date": "2018-09-21T06:59:02",
    "is_private": false
}

Private comment :

{
    "event_type": "Comment",
    "origin_name": "user1@domain.com",
    "comment": "second comment",
    "post_date": "2018-09-23T06:59:01",
    "is_private": true,
    "target_name": "user2@domain.com"
}

Mutations events can be : ADD_USER, ADD_ADMIN, REMOVE_USER, PROMOTE_ADMIN, DEMOTE_ADMIN, CREATE_ALBUM, LEAVE_ALBUM, IMPORT_STUDY, IMPORT_SERIES, REMOVE_STUDY, REMOVE_SERIES or EDIT_ALBUM
IMPORT_STUDY, REMOVE_STUDY :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_STUDY",
    "study": "2.16.840.1.113669.632.20.1211.10000314223"
}

IMPORT_SERIES, REMOVE_SERIES

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_SERIES",
    "study": "2.16.840.1.113669.632.20.1211.10000314223",
    "series": "3.14.840.5.751489.471.55.1218.14752314753"
}

ADD_USER, ADD_ADMIN, REMOVE_USER, PROMOTE_ADMIN, DEMOTE_ADMIN :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-22T06:59:42",
    "target_name": "user2@domain.com",
    "mutation_type": "ADD_USER"
}

LEAVE_ALBUM :

{
    "event_type": "Mutation",
    "origin_name": "titi@gmail.com",
    "post_date": "2018-09-25T07:02:31",
    "mutation_type": "LEAVE_ALBUM"
}

CREATE_ALBUM :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "CREATE_ALBUM"
}

EDIT_ALBUM:

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "EDIT_ALBUM",
    "..." : ...
}

Error Response

If the user is not found.
If the album id does not exist.
If the user is not a member of the album.

  • Status : 404 Not Found
Clone this wiki locally