Notification Service JS Demo

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

1. Configure the client

* If using url https://notifications.test.dataone.org/notifications, you can get a test token from metacat-dev.test.dataone.

2. Try the API endpoints

Subscribe

Unsubscribe

List subscriptions

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, you can pass in a method that fetches a fresh token from the dataone token endpoint.
  • 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 awaits the client call and pushes either the JSON response (if any) or the thrown error into the log viewer.