Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API & Notifications #8487

Closed
arnaudbey opened this issue Mar 15, 2022 · 5 comments · Fixed by #8530
Closed

API & Notifications #8487

arnaudbey opened this issue Mar 15, 2022 · 5 comments · Fixed by #8530
Milestone

Comments

@arnaudbey
Copy link

Hi
is there any way to retrieve notification details through API ?
I managed to get a notifications list (see below) but no info about datetime / dataset involved, etc.

Thanks

{'status': 'OK', 'data': {'notifications': [{'id': 1604, 'type': 'PUBLISHEDDS'}, {'id': 1589, 'type': 'PUBLISHEDDS'}, {'id': 1579, 'type': 'PUBLISHEDDS'}, {'id': 1568, 'type': 'PUBLISHEDDS'}, {'id': 1559, 'type': 'PUBLISHEDDS'}, {'id': 1550, 'type': 'PUBLISHEDDS'}, {'id': 1542, 'type': 'CREATEDS'}, {'id': 1535, 'type': 'PUBLISHEDDS'}, {'id': 1521, 'type': 'ASSIGNROLE'}, {'id': 1463, 'type': 'CREATEACC'}]}

@pdurbin
Copy link
Member

pdurbin commented Mar 15, 2022

@arnaudbey good question. I suppose you found https://guides.dataverse.org/en/5.9/api/native-api.html#get-all-notifications-by-user

I just looked at https://github.com/IQSS/dataverse/blob/v5.9/src/main/java/edu/harvard/iq/dataverse/api/Notifications.java and I'm afraid the "Get All Notifications by User" API endpoint is all we have.

Are you interested in making a pull request to add more functionality?

@arnaudbey
Copy link
Author

I'd like to ! Especially since the changes don't look that complicated to implement. Add some notificationObjectBuilder.add statements with sendDate or other notification properties.

but I'm running out of time to set up a development instance to test my code :(

@pdurbin
Copy link
Member

pdurbin commented May 18, 2022

@arnaudbey good news! I'm reviewing pull request #8530 by @ErykKul and he's adding additional detail to these the JSON output of notifications (I added the timestamp). For example:

{
  "status": "OK",
  "data": {
    "notifications": [
      {
        "id": 5,
        "type": "CREATEDS",
        "subjectText": "Root: Your dataset has been created",
        "messageText": "Hello, \nYour new dataset named test (view at http://localhost:8080/dataset.xhtml?persistentId=doi:10.5072/FK2/XAVUGS ) was created in Root (view at http://localhost:8080/dataverse/root ). To learn more about what you can do with a dataset, check out the Dataset Management - User Guide at https://guides.dataverse.org/en/5.10.1/user/dataset-management.html .",
        "sentTimestamp": "2022-05-18T20:45:21Z"
      },
      {
        "id": 1,
        "type": "ASSIGNROLE",
        "subjectText": "Root: You have been assigned a role",
        "messageText": "Hello, \nYou are now Admin/Dataverse + Dataset Creator for the dataverse \"Root\" (view at http://localhost:8080/dataverse/root ).",
        "sentTimestamp": "2022-05-18T20:40:44Z"
      }
    ]
  }
}

The details about datasets, etc. should be available in the subject or message text. I'll go ahead and mark this issue to be closed by the pull request if it gets merged.

I'll note that while testing this I was reminded that not all API operations (creating a dataset, for example) generate a notification. We could reopen this issue if we'd like to fix this:

@arnaudbey
Copy link
Author

Good news indeed, thanks a lot.
I don't know yet which release will be used here and if it'll include this feature, but sounds promising !

Thanks again 😃

@pdurbin pdurbin added this to the 5.11 milestone Jun 1, 2022
@pdurbin
Copy link
Member

pdurbin commented Jun 1, 2022

@arnaudbey hi, this feature should be in the next release, which as of this writing we are calling 5.11. (The current release is 5.10.1.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants