Outdated version

You are browsing the docs for Nexus v1.7.x, the latest release is available here

Global events

Nexus provides a global events endpoint, which allows the users to access the stream of events for all the resources in Nexus, including ACLs, permissions, realms, etc.

To be able to access the endpoint, the user needs to have events/read permission on /.

Check permissions

HEAD /v1/events

This endpoint allows checking whether the user has permission to read the events without starting the events stream. The response will be either 200 OK if the user does have events/read permission on / or 403 Forbidden otherwise.

Server Sent Events

GET /v1/events

The server sent events response contains a series of events, represented in the following way

data:{payload}
event:{type}
id:{id}

where…

  • {payload}: Json - is the actual payload of the current event
  • {type}: String - is a type identifier for the current event. Possible types are related to core resource types (Resouce, Schema, Resolver) and available plugin types
  • {id}: String - is the identifier of the resource event. It can be used in the Last-Event-Id query parameter

Example

Request
sourcecurl "http://localhost:8080/v1/events"
Response
sourcedata:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/realms.json"],"@type":"RealmCreated","name":"BlueBrain","openIdConfig":"http://localhost:8080/auth/realms/realm1/.well-known/openid-configuration","_authorizationEndpoint":"http://localhost:8080/auth/realms/realm1/protocol/openid-connect/auth","_endSessionEndpoint":"http://localhost:8080/auth/realms/realm1/protocol/openid-connect/logout","_grantTypes":["password","clientCredentials","refreshToken","authorizationCode","implicit"],"_instant":"2021-05-11T09:42:41.313Z","_issuer":"http://localhost:8080/auth/realms/realm1","_label":"realm1","_realmId":"http://localhost:8080/v1/realms/realm1","_rev":1,"_subject":"http://localhost:8080/v1/anonymous","_tokenEndpoint":"http://localhost:8080/auth/realms/realm1/protocol/openid-connect/token","_userInfoEndpoint":"http://localhost:8080/auth/realms/realm1/protocol/openid-connect/userinfo"}
event:RealmCreated
id:3abfce50-b23d-11eb-bef4-251deaef3e83

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/acls.json"],"@type":"AclReplaced","acl":[{"identity":{"@id":"http://localhost:8080/v1/realms/myrealm/groups/a-group","@type":"Group","group":"a-group","realm":"myrealm"},"permissions":["projects/read"]},{"identity":{"@id":"http://localhost:8080/v1/realms/realm/groups/some-group","@type":"Group","group":"some-group","realm":"realm"},"permissions":["projects/read","projects/write"]},{"identity":{"@id":"http://localhost:8080/v1/realms/realm/users/alice","@type":"User","realm":"realm","subject":"alice"},"permissions":["acls/read","acls/write"]}],"_aclId":"http://localhost:8080/v1/acls/org1","_instant":"2021-05-11T11:03:06.071Z","_path":"/org1","_rev":1,"_subject":"http://localhost:8080/v1/anonymous"}
event:AclReplaced
id:76848d80-b248-11eb-a0d9-6dedbaa155f8

data:{"@context":"https://bluebrain.github.io/nexus/contexts/metadata.json","@type":"ResourceCreated","_resourceId":"http://localhost:8080/v1/resources/myorg/myproject/_/7887416b-d501-4508-a625-2a6664dfca94","_source":{"@type":"Hobbit","age":23,"name":"Frodo"},"_types":["http://localhost:8080/v1/vocabs/myorg/myproject/Hobbit"],"_constrainedBy":"https://bluebrain.github.io/nexus/schemas/unconstrained.json","_project":"http://localhost:8080/v1/projects/myorg/myproject","_schemaProject": "http://localhost:8080/v1/projects/myorg/myproject","_instant":"2021-04-24T07:35:47.447631Z","_projectUuid":"1089947c-dc76-4cbc-8b04-3f919b436828","_organizationUuid":"ba7053ba-54ea-41b6-baab-96ec1acd7ad4","_rev": 1,"_subject":"http://localhost:8080/v1/realms/github/users/myuser"}
event:ResourceCreated
id:aebbf8f4-9652-11e9-89a7-6d3c5701d287

data:{"@context":["https://bluebrain.github.io/nexus/contexts/metadata.json","https://bluebrain.github.io/nexus/contexts/permissions.json"],"@type":"PermissionsReplaced","permissions":["custom"],"_instant":"2021-05-10T13:57:16.947Z","_permissionsId":"http://localhost:8080/v1/permissions","_rev":1,"_subject":"http://localhost:8080/v1/anonymous"}
event:PermissionsReplaced
id:a1532190-b197-11eb-a8e0-49728f9d6e6c