MESH-Research / knowledge-commons-works

The next-generation research repository for the Knowledge Commons (formerly Humanities Commons)
https://hcommons.org
MIT License
4 stars 0 forks source link

Webhooks endpoint for updating user/groups data #207

Closed monotasker closed 1 year ago

monotasker commented 1 year ago

The webhook endpoint on the Invenio end for notifications about user data updates will be at /api/webhooks/idp_data_update. It supports GET to simply confirm the endpoint is listening (200 response) and POST to send a signal (202 response if successful).

As we discussed, this just sends notices that updates have happened. Invenio will then query a commons endpoint for the new data.

I've got it set up so far to receive JSON signals with the format below. This allows sending multiple signals in one POST request. It also allows sending signals about updates to group metadata as well as users' individual data.

monotasker commented 1 year ago

Possible signal content format:

{
    "idp": "knowledgeCommons",
    "updates": {
        "users": [{"id": "1234", "event": "updated"},
                  {"id": "5678", "event": "created"}],
        "groups": [{"id": "1234", "event": "deleted"}]
    }
}