User

Returns the current user logged in.

User schema

  • id: Gitter User ID.
  • username: Gitter/GitHub username.
  • displayName: Gitter/GitHub user real name.
  • url: Path to the user on Gitter.
  • avatarUrlSmall: User avatar URI (small).
  • avatarUrlMedium: User avatar URI (medium).

Get the current user

GET /v1/user
[{
  "id": "53307734c3599d1de448e192",
  "username": "malditogeek",
  "displayName": "Mauro Pompilio",
  "url": "/malditogeek",
  "avatarUrlSmall": "https://avatars.githubusercontent.com/u/14751?",
  "avatarUrlMedium": "https://avatars.githubusercontent.com/u/14751?"
}]

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user"
https://api.gitter.im/v1/user?access_token={{token}}
  • curl
  • http

User sub-resources

Rooms

List of Rooms the user is part of.

GET /v1/user/:userId/rooms
[{
  "id": "53307860c3599d1de448e19d",
  "name": "Andrew Newdigate",
  "topic": "",
  "oneToOne": true,
  "userCount": 2,
  "user": {
    "id": "53307831c3599d1de448e19a",
    "username": "suprememoocow",
    "displayName": "Andrew Newdigate",
    "url": "/suprememoocow",
    "avatarUrlSmall": "https://avatars.githubusercontent.com/u/594566?",
    "avatarUrlMedium": "https://avatars.githubusercontent.com/u/594566?"
  },
  "unreadItems": 0,
  "mentions": 0,
  "lastAccessTime": "2014-04-24T15:53:25.662Z",
  "lurk": false,
  "url": "/suprememoocow",
  "githubType": "ONETOONE"
}, {
  "id": "5330777dc3599d1de448e194",
  "name": "gitterHQ",
  "topic": "Gitter",
  "uri": "gitterHQ",
  "oneToOne": false,
  "userCount": 2,
  "unreadItems": 0,
  "mentions": 0,
  "lastAccessTime": "2014-04-24T17:34:00.738Z",
  "lurk": false,
  "url": "/gitterHQ",
  "githubType": "ORG",
  "v": 9
}, {
  "id": "53307793c3599d1de448e196",
  "name": "malditogeek/vmux",
  "topic": "VMUX - Plugin-free video calls in your browser using WebRTC",
  "uri": "malditogeek/vmux",
  "oneToOne": false,
  "userCount": 2,
  "unreadItems": 0,
  "mentions": 0,
  "lastAccessTime": "2014-03-25T11:51:03.758Z",
  "lurk": false,
  "url": "/malditogeek/vmux",
  "githubType": "REPO",
  "v": 1
}]

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/rooms"
https://api.gitter.im/v1/user/:userId/rooms?access_token={{token}}
  • curl
  • http

Unread Items

You can retrieve unread items and mentions using the following endpoint.

GET /v1/user/:userId/rooms/:roomId/unreadItems
{
  "chat": [
    "560ae5f495756f1402bc841d",
    "560aeef6f4b61c106fb2a9f3",
    "560aef2b552ed7913279df52"
  ],
  "mention": [
    "560b167a967c1bad7852bc57"
  ]
}

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/rooms/:roomId/unreadItems"
https://api.gitter.im/v1/user/:userId/rooms/:roomId/unreadItems?access_token={{token}}
  • curl
  • http

Mark Unread Items as "read"

There is an additional endpoint nested under rooms that you can use to mark chat messages as read.

Parameters

  • chat: Array of chatIds.
POST /v1/user/:userId/rooms/:roomId/unreadItems
{
  "chat": [
    "560ae5f495756f1402bc841d",
    "560aeef6f4b61c106fb2a9f3",
    "560aef2b552ed7913279df52",
    "560aef4f081f3a9c044d7d61"
  ]
}

Try it from the CLI:

$ curl -X POST -i -H "Content-Type: application/json" -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/rooms/:roomId/unreadItems" -d '{"chat":["560ae5f495756f1402bc841d","560aeef6f4b61c106fb2a9f3","560aef2b552ed7913279df52","560aef4f081f3a9c044d7d61"]}'
Sorry, you can't post with this method (http)
  • curl
  • http

Orgs

List of the user's GitHub Organisations and their respective Room if available.

GET /v1/user/:userId/orgs
[{
  "id": 5990364,
  "name": "gitterHQ",
  "avatar_url": "https://avatars.githubusercontent.com/u/5990364?",
  "room": {
    "id": "5330777dc3599d1de448e194",
    "name": "gitterHQ",
    "topic": "Gitter",
    "uri": "gitterHQ",
    "oneToOne": false,
    "userCount": 2,
    "unreadItems": 0,
    "mentions": 0,
    "lastAccessTime": "2014-03-25T11:50:49.799Z",
    "lurk": false,
    "url": "/gitterHQ",
    "githubType": "ORG",
    "v": 1
  }
}, {
  "id": 4046959,
  "name": "lnug",
  "avatar_url": "https://avatars.githubusercontent.com/u/4046959?"
}]

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/orgs"
https://api.gitter.im/v1/user/:userId/orgs?access_token={{token}}
  • curl
  • http

Repos

List of the user's GitHub Repositories and their respective Room if available.

Note: It'll return private repositories if the current user has granted Gitter privileges to access them.

GET /v1/user/:userId/repos
[{
  "id": 10974239,
  "name": "malditogeek/vmux",
  "uri": "malditogeek/vmux",
  "private": false,
  "room": {
    "id": "53307793c3599d1de448e196",
    "name": "malditogeek/vmux",
    "topic": "VMUX - Plugin-free video calls in your browser using WebRTC",
    "uri": "malditogeek/vmux",
    "oneToOne": false,
    "userCount": 2,
    "unreadItems": 0,
    "mentions": 0,
    "lastAccessTime": "2014-03-25T11:51:03.758Z",
    "lurk": false,
    "url": "/malditogeek/vmux",
    "githubType": "REPO",
    "v": 1
  }
}, {
  "id": 15316813,
  "name": "gitterHQ/marked",
  "uri": "gitterHQ/marked",
  "private": false
}, {
  "id": 16485332,
  "name": "gitterHQ/emojify.js",
  "uri": "gitterHQ/emojify.js",
  "private": false
}]

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/repos"
https://api.gitter.im/v1/user/:userId/repos?access_token={{token}}
  • curl
  • http

Channels

List of Gitter channels nested under the current user.

GET /v1/user/:userId/channels
[{
  "id": "533177b9c3599d1de448e1a1",
  "name": "malditogeek/AMA",
  "topic": "",
  "uri": "malditogeek/AMA",
  "oneToOne": false,
  "unreadItems": 0,
  "mentions": 0,
  "lastAccessTime": "2014-03-25T12:34:03.681Z",
  "lurk": false,
  "url": "/malditogeek/AMA",
  "githubType": "USER_CHANNEL",
  "security": "PUBLIC"
}]

Try it from the CLI:

$ curl -i -H "Accept: application/json" -H "Authorization: Bearer {{token}}" "https://api.gitter.im/v1/user/:userId/channels"
https://api.gitter.im/v1/user/:userId/channels?access_token={{token}}
  • curl
  • http