Notification Service JS Demo
Configure the client, then try subscribing, unsubscribing, or listing subscriptions for a resource.
1. Configure the client
2. Try the API endpoints
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
NotificationClientinstance is created after you submit the configuration form. -
getTokenis 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. -
validatePIDis 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.