Skip to content

Get a list of events (comments and mutations)

gerome12 edited this page Mar 5, 2021 · 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)
  • Mutations filter only if types={mutations}
    • filter by mutation type of family family={WEBHOOKS, SENDING, USERS, REPORT_PROVIDER}
    • filter by date startDate endDate format : yyyy-MM-dd HH:mm:ss or yyyy-MM-dd
    • filter by seriesUID series={seriesUID}
    • filter by studyUID studies={studyUID}
    • filter by capability token capabilityToken={capability token id}
    • filter by user user={sub}
    • filter by report provider reportProvider={reportprovider id}

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)",
       "series": [
          {
             "UID": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001282",
             "description": "PET WB1",
             "is_present_in_album": true
          },
          {
             "UID": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001283",
             "description": "PET WB2",
             "is_present_in_album": true
          }
       ]
    } 
}

with a capability token (the user in the field source is the user who created the capability token, not the user who made the mutation)

{
    "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)",
       "series": [
          {
             "UID": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001282",
             "description": "PET WB1",
             "is_present_in_album": true
          },
          {
             "UID": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001283",
             "description": "PET WB2",
             "is_present_in_album": true
          }
       ]
    } 
}

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": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001282",
             "description": "PET WB1",
             "is_present_in_album": true
          }
       ]
    }
}

with a capability token (the user in the field source is the user who created the capability token, not the user who made the mutation) :

{
    "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": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001282",
             "description": "PET WB1",
             "is_present_in_album": true
          }
       ]
    }
}

import series with a report provider

{
    "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_SERIES",
    "study": {
       "UID": "2.16.840.1.113669.632.20.1211.10000314223",
       "description": "PET^PETCT_WB_apc (Adult)",
       "series": [
          {
             "UID": "1.3.12.2.1107.5.1.4.48545.30000006091906505451500001282",
             "description": "PET WB1",
             "is_present_in_album": true
          }
       ]
    }
}

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"
    }
}

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