# Project controller (/project) - Watch
The project controller contains many endpoints related to projects, which is where all data is stored. The endpoints are divided in five groups:
General
Get information about available projects and tables within projects, and run a basic check of access and system status.Users
Manage users that are members of a project.Read
Read user data from tables.Write
Create, update or delete user data in tables.Watch
Watch for changes of user data in tables, and for changes of project members.
# All project endpoints
Below are all endpoints in the entire project controller in alphabetical order. Endpoints in the current group are in bold.
/project/list (GET)
/project/list/all (GET)
/project/{project}/check (GET)
/project/{project}/subjects/watch/register (POST)
/project/{project}/subjects/watch/unregister/{id} (POST)
/project/{project}/subjects/watch/{id} (GET)
/project/{project}/table/{table} (GET)
/project/{project}/table/{table} (POST)
/project/{project}/table/{table} (DELETE)
/project/{project}/table/{table}/filter/delete (POST)
/project/{project}/table/{table}/filter/get (POST)
/project/{project}/table/{table}/filter/get/first (POST)
/project/{project}/table/{table}/filter/get/last (POST)
/project/{project}/table/{table}/first (GET)
/project/{project}/table/{table}/last (GET)
/project/{project}/table/{table}/purge (DELETE)
/project/{project}/table/{table}/spec (GET)
/project/{project}/table/{table}/watch/register (POST)
/project/{project}/table/{table}/watch/unregister/{id} (POST)
/project/{project}/table/{table}/watch/{id} (GET)
/project/{project}/table/{table}/{recordId} (GET)
/project/{project}/table/{table}/{recordId} (PUT)
/project/{project}/table/{table}/{recordId} (DELETE)
/project/{project}/tables (GET)
/project/{project}/user (POST)
/project/{project}/user (DELETE)
/project/{project}/users (GET)
# /{project}/table/{table}/watch/register
There are two ways to watch for new database actions. The preferred way is with a callback URL. The other way is with long polling using . If you want to receive a callback, you should specify the callback URL.
If a registration with the same parameters already exists, it does not create a new registration, but re-uses the current registration. Any client that was watching that registration will be cancelled. This method returns a registration ID that you can pass to .
If you no longer want to watch the table, you can call . The server also cleans up registrations automatically. Registrations
with a callback URL are removed if the callback failed at least 5 times for at
least 24 hours in a row. Registrations without a callback are removed if they
haven’t been watched for an hour.
Finally a callback can indicate deletion through its response. It should return
404 Not Found
with this JSON payload:
{ "error": "callback_expired" }
The callback will be called with HTTP method POST. Its payload will be a JSON object with these properties:
{ "project": "default", "table": "steps", "subjects": [ "b43f784d76c44e7a9ae0370b91521753" ] }Admins may set parameter ‘anyUser’ so they are notified whenever a database action occurs for any user in the specified table.
All users can access their own data within a project that they can access.
Patients can only access their own data.
Professionals can access the data of users to whom they were granted access.
Admins can access all data.
POST https://www.example.com/servlets/senseeact/v6.1.0/project/default/table/steps/watch/register ?user=b43f784d76c44e7a9ae0370b91521753 &callbackUrl=https://www.example.com/callback &reset=false X-Auth-Token: ...
6205a45f4afc4e31af67c6315963745b
GET https://www.example.com/servlets/senseeact/v6.1.0/project/default/table/steps/watch/register ?anyUser=true &callbackUrl=https://www.example.com/callback &reset=false X-Auth-Token: ...
6205a45f4afc4e31af67c6315963745b
# /{project}/table/{table}/watch/{id}
As soon as there are new database actions, this method returns them. This may include actions that occurred since the registration or last watch and that you haven’t received yet. If no actions occur before the time-out, this method returns an empty list.
Only one client can watch a specific registration. If another client registers or starts to watch the same registration, then the current client will be cancelled. This means that this method will return immediately with an empty list result. Likewise, when you call this method, any other clients that were watching the same registration, will be cancelled.
If you disconnect the client during a watch, the server may still send an action and think that you received it. If you start a new session and don’t want to miss any actions, it’s best to call a read endpoint after the watch registration.
You should specify a registration ID that you got from . If you no longer want to watch the table, you should call . Note that the server may automatically clean up registrations that haven’t been watched for an hour.
GET https://www.example.com/servlets/senseeact/v6.1.0/project/default/table/steps/watch /6205a45f4afc4e31af67c6315963745b X-Auth-Token: ...
[ "b43f784d76c44e7a9ae0370b91521753", ... ]
# /{project}/table/{table}/watch/unregister/{id}
POST https://www.example.com/servlets/senseeact/v6.1.0/project/default/table/steps/watch /unregister/6205a45f4afc4e31af67c6315963745b X-Auth-Token: ...
–
# /{project}/subjects/watch/register
This method returns a registration ID that you can pass to . If a registration with the same parameters already exists, then this method returns the ID of that registration. Any client that was watching that registration will be cancelled.
If you no longer want to watch active subjects, you should call . Note that the server may automatically clean up registrations that haven’t been watched for an hour.
POST https://www.example.com/servlets/senseeact/v6.1.0/project/default/subjects/watch/register ?reset=false X-Auth-Token: ...
6205a45f4afc4e31af67c6315963745b
# /{project}/subjects/watch/{id}
As soon as there are new events, this method returns those events. This may include events that occurred since the registration or last watch and that you haven’t received yet. If no events occur before the time-out, this method returns an empty list.
Only one client can watch a specific registration. If another client registers or starts to watch the same registration, then the current client will be cancelled. This means that this method will return immediately with an empty list result. Likewise, when you call this method, any other clients that were watching the same registration, will be cancelled.
If you disconnect the client during a watch, the server may still send an event and think that you received it. If you start a new session and don’t want to miss any events, it’s best to call a read endpoint after the watch registration.
You should specify a registration ID that you got from . If you no longer want to watch the subjects, you should call . Note that the server may automatically clean up registrations that haven’t been watched for an hour.
When a subject is added:
When a subject is removed:
When the user profile of a subject is updated:
GET https://www.example.com/servlets/senseeact/v6.1.0/project/default/subjects/watch /6205a45f4afc4e31af67c6315963745b X-Auth-Token: ...
[ { "type": "ADDED", "user": "b43f784d76c44e7a9ae0370b91521753" }, { "type": "REMOVED", "user": "b43f784d76c44e7a9ae0370b91521753" }, { "type": "PROFILE_UPDATED", "user": "b43f784d76c44e7a9ae0370b91521753", "oldProfile": { "email": "user@example.com", "role": "PATIENT" ... }, "newProfile": { "email": "user@example.com", "role": "PATIENT" ... } } ]
# /{project}/subjects/watch/unregister/{id}
POST https://www.example.com/servlets/senseeact/v6.1.0/project/default/subjects/watch /unregister/6205a45f4afc4e31af67c6315963745b X-Auth-Token: ...
–