GET /api/notifications

get notifications directed toward the current user

Success Response Code: 200

Additional Routes

  • (/notifications/:filter) get notifications directed toward the current user restricted by filter

Params

Param name Description
page
optional

page number of notifications to be returned


Value: Must be a Integer
per_page
optional

number of notifications to be returned in each result (default=20, max=500)


Value: Must be a Integer
filter
optional

filter notifications


Value: Must be one of: <code>thanks</code>, <code>groups</code>, <code>at_mentions</code>, <code>broadcast</code>, <code>replies</code>, <code>projects</code>, <code>followers</code>, <code>town_halls</code>.

Response Fields

notifications_count count of all the notifications returned Integer
unread_notifications_count count of all the unread notifications returned Integer
notifications notifications in order of most recent Array<Notification>
notification[id] id of the notification Integer
notification[read] whether or not the notification has been read Boolean
notification[notifiable_id] id of the object that triggered the notification Integer
notification[notifiable_type] type of the object that triggered the notification String
notification[notifiable_text] snippet of text associated with the notifiable object String
notification[notifiable_url] url to the notifiable resource to retrieve more information about the resource String
notification[filter] the filter that can be used to retrieve just notifications of this type (thanks|groups|at_mentions|broadcast|replies|projects|followers|town_halls) Array
notification[verb] the verb of the notification (The the current user with ) String
notification[sent_by_user] the person who triggered the notification. See User response for more detail Hash<User>
notification[created_at] when the notification was triggered DateTime

Example Curl Commands

curl -X GET -v --basic -u "emily@socialcast.com:demo" "https://demo.socialcast.com/api/notifications.json"
#using filters
curl -X GET -v --basic -u "emily@socialcast.com:demo" "https://demo.socialcast.com/api/notifications/groups.json"

Examples

GET /notifications.json
200
{
  "notifications_count": 1,
  "unread_notifications_count": 1,
  "notifications": [
    {
      "id": 26,
      "read": false,
      "notifiable_id": 6,
      "notifiable_type": "Contact",
      "notifiable_text": null,
      "notifiable_url": "https://socialcast.socialcast.test/users/112-j%C3%B8hn100d%C3%B8e98?ref=desktop_notification",
      "filter": "followers",
      "verb": "followed",
      "sent_by_user": {
        "id": 113,
        "first_name": "J'øhn101",
        "last_name": "D'øe99",
        "name": "J'øhn101 D'øe99",
        "html_name": "J&#39;øhn101 D&#39;øe99",
        "url": "https://socialcast.socialcast.test/users/113-j%C3%B8hn101d%C3%B8e99",
        "avatars": {
          "is_system_default": true,
          "id": null,
          "square16": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square16-3b951350d61d203ece2fa5dd274fa7bd35275e132c17310d9006514f8839c857.png",
          "square30": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square30-6db66ac25c338d1e548a68465e2723ff63367c2aafbcc01db24c83964056b892.png",
          "square45": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square45-16865426333e244c59076d4f2475b711ed1ff9d12c97f4cf354f373a0170a1fd.png",
          "square70": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square70-1708999e8f1fea583408d7fc64b2177f853e4123bea2ffcf35f4839c8697e0ba.png",
          "square140": "https://socialcast.socialcast.test/assets-test/v6/avatars/default_user_square140-7da7e1d98b33ef152280b1f653cfd80e2db24b01b625a72abc320673eea5af53.png"
        },
        "username": "Jøhn101Døe99",
        "active": true,
        "terminated": false,
        "inactive": false,
        "role": "member",
        "type": "User",
        "title": null,
        "out_of_office": false,
        "out_of_office_on": null,
        "back_in_office_on": null,
        "company_login": null
      },
      "created_at": "2017-11-17T10:48:05-08:00"
    }
  ]
}