Notification Service JS Demo

Configure the client, then try subscribing, unsubscribing, or listing subscriptions for a resource.

1. Configure the client

* If using service root https://notifications.test.dataone.org/notifications with API version v1, you can get a test token from metacat-dev.test.dataone.

2. Try the API endpoints

Ping

Subscribe

Unsubscribe

List subscriptions

Find resource types for PID

3. Inspect responses

Requests rely on your network environment and token. Any thrown error is logged below so you can see what the client received from the service.

Implementation notes

How this demo uses the library
  • A single NotificationClient instance is created after you submit the configuration form.
  • getToken is a promise-returning callback that reads the token input. In production, pass in a method that returns a current DataONE token. The ping endpoint does not use this callback.
  • validatePID is a simple async check that ensures the PID input is not empty. In the future, we could replace it with verification that the resource type matches the format ID of the object.
  • Each form handler calls the client with an object argument and pushes either the JSON response (if any) or the thrown error into the log viewer.