Skip to content

Get a list of events (comments and mutations)

gerome12 edited this page May 16, 2019 · 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 : /albums/{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, CreateReportProvider, EditReportProvider, DeleteReportProvider, NewReport
  • 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, EDIT_ALBUM, CREATE_REPORT_PROVIDER, EDIT_REPORT_PROVIDER, DELETE_REPORT_PROVIDER or NEW_REPORT

IMPORT_STUDY, REMOVE_STUDY :
by a user :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_STUDY",
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    } 
}

with a capability token

{
    "event_type": "Mutation",
    "capability": {
       "id": "hIU3IUjdh9",
       "title": "the title"
    },
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_STUDY",
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    } 
}

IMPORT_SERIES, REMOVE_SERIES :
by a user :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_SERIES",
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    },
    "series": {
       "UID": "3.14.840.5.751489.471.55.1218.14752314753",
       "description": "CT WB_Native_2mm"
    } 
}

with a capability token :

{
    "event_type": "Mutation",
    "capability": {
       "id": "hIU3IUjdh9",
       "title": "the title"
    },
    "post_date": "2018-09-25T07:35:41",
    "mutation_type": "IMPORT_SERIES",
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    },
    "series": {
       "UID": "3.14.840.5.751489.471.55.1218.14752314753",
       "description": "CT WB_Native_2mm"
    } 
}

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",
    "..." : ...coming soon
}

CREATE_REPORT_PROVIDER, EDIT_REPORT_PROVIDER, DELETE_REPORT_PROVIDER:

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "CREATE_REPORT_PROVIDER",
    "report_provider": {
        "name": "name",
        "is_removed": false,
        "id": "dhiuGD29Hhbniu"
    }
}

If the report provider has been removed :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "DELETE_REPORT_PROVIDER",
    "report_provider": {
        "name": "name",
        "is_removed": true
    }
}

NEW_REPORT:

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "NEW_REPORT",
    "report_provider": {
        "name": "name",
        "is_removed": false,
        "id": "dhiuGD29Hhbniu"
    },
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    },
    "series": {
       "UID": "3.14.840.5.751489.471.55.1218.14752314753",
       "description": "report description"
    } 
}

If the report provider has been removed :

{
    "event_type": "Mutation",
    "origin_name": "user1@domain.com",
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "NEW_REPORT",
    "report_provider": {
        "name": "name",
        "is_removed": true
    },
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)"
    },
    "series": {
       "UID": "3.14.840.5.751489.471.55.1218.14752314753",
       "description": "report description"
    } 
}

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