Skip to content

Get a list of events (comments and mutations)

gerome12 edited this page Apr 23, 2020 · 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.

can_access={boolean} is if the user is still or not a member of the album or if he still hase access to the study.

[
    {
        "event_type": "Comment",
        "source": {
            "email": "user1@domaine.com",
            "name": "user1 name",
            "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
            "can_access": true,
            "is_admin": true
        },
        "comment": "second comment",
        "post_date": "2018-09-23T06:59:01",
        "is_private": true,
        "target": {
            "email": "user2@domaine.com",
            "name": "user2 name",
            "sub": "d4f3b303bd4e-4b98-dac4-9341-c2fd0b66",
            "can_access": true,
            "is_admin": true
        }
    },
    {
        "event_type": "Mutation",
        "source": {
            "email": "user1@domaine.com",
            "name": "user1 name",
            "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
            "can_access": true,
            "is_admin": true
        },
        "post_date": "2018-09-22T06:59:42",
        "target": {
            "email": "user2@domaine.com",
            "name": "user2 name",
            "sub": "d4f3b303bd4e-4b98-dac4-9341-c2fd0b66",
            "can_access": true,
            "is_admin": false
        },
        "mutation_type": "ADD_USER"
    },
    {
        "event_type": "Comment",
        "source": {
            "email": "user1@domaine.com",
            "name": "user1 name",
            "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
            "can_access": true,
            "is_admin": true
        },
        "comment": "first comment",
        "post_date": "2018-09-21T06:59:02",
        "is_private": false
    },
    {
        "event_type": "Mutation",
        "source": {
            "email": "user1@domaine.com",
            "name": "user1 name",
            "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
            "can_access": true,
            "is_admin": true
        },
        "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "comment": "first comment",
    "post_date": "2018-09-21T06:59:02",
    "is_private": false
}

Private comment :

{
    "event_type": "Comment",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "comment": "second comment",
    "post_date": "2018-09-23T06:59:01",
    "is_private": true,
    "target": {
        "email": "user2@domaine.com",
        "name": "user2 name",
        "sub": "d4f3b303bd4e-4b98-dac4-9341-c2fd0b66",
        "can_access": true,
        "is_admin": true
    }
}

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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": false
    },
    "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": false,
        "capability_token": {
            "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": false,
        "capability_token": {
            "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "post_date": "2018-09-22T06:59:42",
    "target": {
        "email": "user2@domaine.com",
        "name": "user2 name",
        "sub": "d4f3b303bd4e-4b98-dac4-9341-c2fd0b66",
        "can_access": true,
        "is_admin": false
    },
    "mutation_type": "ADD_USER"
}

LEAVE_ALBUM :

{
    "event_type": "Mutation",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": false
    },
    "post_date": "2018-09-25T07:02:31",
    "mutation_type": "LEAVE_ALBUM"
}

CREATE_ALBUM :

{
    "event_type": "Mutation",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "CREATE_ALBUM"
}

EDIT_ALBUM:

{
    "event_type": "Mutation",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "is_admin": true
    },
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "DELETE_REPORT_PROVIDER",
    "report_provider": {
        "name": "name",
        "is_removed": true,
        "id": "dhiuGD29Hhbniu"
    }
}

NEW_REPORT:

{
    "event_type": "Mutation",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "report_provider": {
            "name": "name",
            "is_removed": false,
            "id": "dhiuGD29Hhbniu"
        }
    },
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "NEW_REPORT",
    "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",
    "source": {
        "email": "user1@domaine.com",
        "name": "user1 name",
        "sub": "c2fd0b66-dac4-4b98-9341-d4f3b303bd4e",
        "can_access": true,
        "report_provider": {
            "name": "name",
            "is_removed": true,
            "id": "dhiuGD29Hhbniu"
        }
    },
    "post_date": "2018-09-20T06:58:28",
    "mutation_type": "NEW_REPORT",
    "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