SHIFT API

Users

API routes for user management.

Teams are a collection of users with specific roles and a space for messages to exist.Membership type 1 indicates a team admin, while 2 represents a normal member. All of the user data is in the user key in the response data.

API Reference

GET
/v1/users/<uuid:user_id>

Return the user with the given user id:

When loading a user, the information returned will be less than when retrieving the session user. Additional layers of information privacy are currently in the works.

Example 1

Get information about another user

GET /v1/users/:uuid

JSON response body:

{
  "meta": {}, 
  "data": [
    {
      "first_name": "Testy", 
      "last_name": "Testerson", 
      "title": "", 
      "id": "1a2d4036-8e3f-4841-b5e0-4eafbdfd240f", 
      "online": false, 
      "image": {
          "default": "https://geplatform.s3.amazonaws.com/user/9b0d8dc1-5d4e-4703-a864-e524185b8928/8f46d154-e722-4ee2-a833-baed6384b555-default.jpg",
          "original": "https://geplatform.s3.amazonaws.com/user/9b0d8dc1-5d4e-4703-a864-e524185b8928/8f46d154-e722-4ee2-a833-baed6384b555-original.jpg",
          "fullwidth": "https://geplatform.s3.amazonaws.com/user/9b0d8dc1-5d4e-4703-a864-e524185b8928/8f46d154-e722-4ee2-a833-baed6384b555-fullwidth.jpg",
          "square300": "https://geplatform.s3.amazonaws.com/user/9b0d8dc1-5d4e-4703-a864-e524185b8928/8f46d154-e722-4ee2-a833-baed6384b555-square300.jpg",
          "icon": "https://geplatform.s3.amazonaws.com/user/9b0d8dc1-5d4e-4703-a864-e524185b8928/8f46d154-e722-4ee2-a833-baed6384b555-icon.jpg"
        }
      "email": "test212465155459183074575100531328@grapheffect.com"
    }
  ], 
  "time": 0.02019214630126953
}

Example 2

Attempt to get information about a user that does not exist

GET /v1/users/:uuid

JSON response body:

{
  "errors": [
    {
      "message": "Unknown error", 
      "code": 4001
    }
  ]
}
GET
/v1/users/me

Return the currently authorized user

Obtain all available information about the current session user. Preferences should be respected in a third party application where applicable.

Example 1

Get current session user data

GET /v1/users/me

JSON response body:

{
  "meta": {}, 
  "data": [
    {
      "origin": null, 
      "superuser": false, 
      "last_name": "Testerson", 
      "updated_at": 1355247743.521, 
      "images": [], 
      "id": "e7696032-c26d-4b31-a1b7-d5cc672f59de", 
      "developer": false, 
      "first_name": "Testy", 
      "title": "", 
      "primary_phone_number": {}, 
      "location": "", 
      "primary_email": {
        "user_id": "e7696032-c26d-4b31-a1b7-d5cc672f59de", 
        "company": null, 
        "verified": false, 
        "id": "685de141-2cd0-45eb-b06f-c34e7c5f860d", 
        "address": "test@grapheffect.com"
      }, 
      "online": false, 
      "alternate_emails": [], 
      "alternate_phone_numbers": [], 
      "type": 1, 
      "username": "test_47503403616951", 
      "relationship": 0, 
      "unread_counts": {
        "teams": {}, 
        "user": {
          "total": 0, 
          "direct": 0
        }, 
        "tags": {
          "_sent": 0, 
          "_other": 0, 
          "_inbox": 0, 
          "_direct": 0, 
          "_unread": 0
        }
      }, 
      "company": "", 
      "facebook_id": null, 
      "online_info": null, 
      "pending_domains": [], 
      "active": true, 
      "password": null, 
      "prefs": {
        "email_on_team_invite": true, 
        "email_on_team_removed": true, 
        "email_on_reply_to_your_direct_message": true, 
        "email_on_at_mention": true, 
        "email_on_shift_update": true, 
        "email_on_direct_message": true, 
        "email_on_sidebar_message": true, 
        "email_on_team_role_changed": true, 
        "email_on_team_message": true, 
        "email_on_reply_to_message_you_replied_to": true
      }, 
      "created_at": 1355247743.502, 
      "companies": [], 
      "is_mutual_connection": false
    }
  ], 
  "time": 0.05590105056762695
}

Example 2

Attempt to get session user with no authentication

GET /v1/users/me

JSON response body:

{
  "errors": [
    {
      "message": "Not authorized", 
      "code": 4010
    }
  ]
}
GET
/v1/users/me/connections

query query: Search query to match a user's name Optional
type query: str
query users: User ids to intersect connections on Optional
type users: uuid list

Get all connections for the session user

Either a query or user ids to filter by must be specified. All users in common with the specified users or all users within the session user's connections matching the query will be returned.

Example 1

Get all connections for the session user

Currently, this route returns all members of all teams that the session user is a member of.

GET /v1/users/me/connections

JSON response body:

{
  "meta": {
    "num_connections": 3
  }, 
  "data": [
    {
      "first_name": "Testy", 
      "last_name": "Testerson", 
      "relationship": 0, 
      "title": "", 
      "id": "b1bf626f-c9fa-453b-8f64-bbdb5d22604d", 
      "active": true, 
      "online": null, 
      "images": [], 
      "email": "test686647017930529704290206065512@grapheffect.com"
    }, 
    {
      "first_name": "Testy", 
      "last_name": "Testerson", 
      "relationship": 0, 
      "title": "", 
      "id": "cb7fc152-8709-4e63-8f99-1e245f552876", 
      "active": true, 
      "online": null, 
      "images": [], 
      "email": "test242095559330037788724779768815@grapheffect.com"
    }, 
    {
      "first_name": "Testy", 
      "last_name": "Testerson", 
      "relationship": 0, 
      "title": "", 
      "id": "ac37d49b-d4d5-4d89-ab6d-4df55d4096e5", 
      "active": true, 
      "online": null, 
      "images": [], 
      "email": "test955621939920208680449885887078@grapheffect.com"
    }
  ], 
  "time": 0.12935900688171387
}

Example 2

Get connections the session user has in common with another user

GET /v1/users/me/connections?users=:uuid

JSON response body:

{
  "meta": {
    "num_connections": 1
  }, 
  "data": [
    {
      "first_name": "Testy", 
      "last_name": "Testerson", 
      "relationship": 0, 
      "title": "", 
      "id": "5e140ce0-73a2-46e0-af3c-a30b0997f77f", 
      "active": true, 
      "online": null, 
      "images": [], 
      "email": "test284621922746310936821924317695@grapheffect.com"
    }
  ], 
  "time": 0.056231021881103516
}

Example 3

Search for session user's connections by name

GET /v1/users/me/connections?query=ar

JSON response body:

{
  "meta": {}, 
  "data": [
    {
      "first_name": "Martin", 
      "last_name": "Heidegger", 
      "relationship": 0, 
      "title": "", 
      "id": "0ffe8829-9497-495d-b6ad-f653fcbdda8a", 
      "active": true, 
      "online": false, 
      "images": [], 
      "email": "test248951710857962181147621037208@grapheffect.com"
    }, 
    {
      "first_name": "Jean-Paul", 
      "last_name": "Sartre", 
      "relationship": 0, 
      "title": "", 
      "id": "51c7af87-7b9b-4c17-8db5-83fef816f4ef", 
      "active": true, 
      "online": false, 
      "images": [], 
      "email": "test923373516265706787838567151064@grapheffect.com"
    }
  ], 
  "time": 0.014215946197509766
}
GET
/v1/users/me/teams

query users: Comma separated user ids to filter teams in common with
type users: uuid list

Returns the team memberships for the current user

If filtering by teams in common with other user(s), only team ids are returned. See Example 2.

Example 1

Get team memberships for the session user

GET /v1/users/me/teams

JSON response body:

{
  "meta": {}, 
  "data": [
    {
      "membership_type": 1, 
      "is_muted": 0, 
      "created_at": 1355247743, 
      "userid": "b989d73e-ad97-45c4-9539-ab0d4cedc1db", 
      "updated_at": 1355247743, 
      "is_favorite": 0, 
      "user": {
        "first_name": "Testy", 
        "last_name": "Testerson", 
        "relationship": 0, 
        "title": "", 
        "id": "b989d73e-ad97-45c4-9539-ab0d4cedc1db", 
        "active": true, 
        "online": false, 
        "images": [], 
        "email": "test@grapheffect.com"
      }, 
      "team": {
        "num_members": 1, 
        "name": "Team460629714376707438650713623798", 
        "color": "blue", 
        "created_at": 1355247743.797, 
        "updated_at": 1355247743.838, 
        "unread_count": 1, 
        "active": true, 
        "id": "9f9602a7-2102-4299-9ac5-e607b2289d08", 
        "icon": "turtle"
      }, 
      "inviter": {
        "first_name": "Testy", 
        "last_name": "Testerson", 
        "relationship": 0, 
        "title": "", 
        "id": "b989d73e-ad97-45c4-9539-ab0d4cedc1db", 
        "active": true, 
        "online": false, 
        "images": [], 
        "email": "test@grapheffect.com"
      }
    }
  ], 
  "time": 0.011986017227172852
}

Example 2

Get teams in common between the session user and another user

GET /v1/users/me/teams?users=:uuid

JSON response body:

{
  "meta": {}, 
  "data": [
    "59a5d167-de43-4c74-b0e4-d1c8396c7cb5"
  ], 
  "time": 0.04527592658996582
}