REST API: List Notifications

Last Updated: November 05, 2015

Description

Retrieves a list of notifications associated with your company, with filters to narrow down the results.

Resource Information

HTTP Method GET
Endpoint https://rest.tsheets.com/api/v1/notifications
Authentication Token header required. See authentication section
Request format Everything is handled through the request uri on a GET.
Response format json
Response object Notification

Available Filters

If no filters are set, all notifications for the requesting user (based on the Access-Token) will be returned.

ids:
optional
Integer. Comma separated list of one or more notification ids you'd like to filter on. Only notifications with an id set to one of these values will be returned.
delivery_before:
optional
String (ISO8601 format). Only notifications with a delivery date/time before this date/time will be returned (i.e. 2015-06-12T15:19:21+00:00).
delivery_after:
optional
String (ISO8601 format). Only notifications with a delivery date/time after this date/time will be returned (i.e. 2015-06-12T15:19:21+00:00).
user_id:
optional
Integer. Only notifications linked to this user ID will be returned. Only administrators may retrieve notifications for users other than themselves. Furthermore, administrators may only retrieve notifications for users that belong to their company.
msg_tracking_id:
optional
String. Tracking ID string of a notification. Only the notification with this msg_tracking_id will be returned.
per_page:
optional
Integer. Represents how many results you'd like to retrieve per request (page). Default is 50. Max is 50.
page:
optional
Integer. Represents the page of results you'd like to retrieve. Default is 1.

Examples

Retrieve a list of all notifications scheduled for a specific user. Note: The code example below references a user id that will need to be substituted with a user id associated with your TSheets account.

## REQUEST
curl -H "Authorization: Bearer <Access-Token>" -i "https://rest.tsheets.com/api/v1/notifications?user_id=1242515"

## RESPONSE (shortened for readability)
HTTP/1.1 200 OK
Content-Type: application/json

{
 "results": {
  "notifications": {
   "94140225": {
    "id": 94140223,
    "msg_tracking_id": "baabeb0ab03d62ce",
    "user_id": 1242515,
    "message": "Please clock in!",
    "method": "push",
    "delivery_time": "2015-06-24T15:00:00+00:00",
    "created": "2015-06-23T14:17:57+00:00",
    "precheck": "off_the_clock"
   },
   "94140225": {
    "id": 94140225,
    "msg_tracking_id": "3ce75c1b7de6598a",
    "user_id": 1242515,
    "message": "Please clock out!",
    "method": "push",
    "delivery_time": "2015-06-24T23:00:00+00:00",
    "created": "2015-06-23T14:17:57+00:00",
    "precheck": "on_the_clock"
   }
  },
  "more": false
}