Management

Groups

A Group is a subset of users in a Mode Workspace. Admins can use groups to manage access to database connections and Collections for clusters of members with similar needs (e.g., departments, project teams, etc.).

You can use the groups resource to retrieve information about a single group or about all groups in a Workspace. You can also use it to update a group.

Please note that groups are only available to Mode Business customers, and access to this resource is only available to admins.

Group object

Properties

token

required

string

group_type

required

string

name

required

string

description

required

string

state

required

string

member_count

required

string

spaces_count

required

string

data_sources_count

required

string

managed

required

string

_links

required

object

All resource responses contain a set of links that describe other related resources or actions that you can take on this resource. A link is comprised of two main pieces: its name (which describes its relationship to this resource) and its href (the URL of the related action or resource). All resources have at least a _self link which is the URL that will return a representation of this resource.

  • creator
  • group_memberships
  • membership_by_id
  • memberships_preview
  • self
  • web
{
  "token": "9786ujhytvf",
  "group_type": "ullamco",
  "name": "non sint est",
  "description": "Ut cupidatat anim laboris",
  "state": "officia elit Duis nisi",
  "member_count": "fugiat dolore labore",
  "_links": {
    "self": {
      "href": "ei",
      "templated": false
    },
    "web": {
      "href": "nulla fugiat",
      "templated": false
    },
    "creator": {
      "href": "sit ut cupidatat aute",
      "templated": false
    },
    "group_memberships": {
      "href": "est non",
      "templated": false
    },
    "membership_by_id": {
      "href": "non ex",
      "templated": false
    },
    "memberships_preview": {
      "href": "cillum",
      "templated": false
    }
  },
  "_embedded": {}
}

Get a group

To retrieve information about a single group, send a GET request to the groups resource with that group’s group_token.

URL Params

workspace

required
string Workspace username

group_token

required
string UserGroup token
Responses

200

UserGroup response

401

Unauthorized

403

Forbidden

404

Membership not found for Workspace

GET /{workspace}/groups/{group_token}

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://app.mode.com/api/{workspace}/groups/{group_token}'
require 'http'

username = 'your_api_key'
password = 'your_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://app.mode.com/api/{workspace}/groups/{group_token}')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/groups/{group_token}', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'GET',
  url: 'https://app.mode.com/api/{workspace}/groups/{group_token}',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  }}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

List groups

To get a list of all groups in your Workspace, send a GET request to the groups resource.

URL Params

workspace

required
string Workspace username
Responses

200

UserGroup collection response

401

Unauthorized

403

Forbidden

404

Membership not found for Workspace

GET /{workspace}/groups

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://app.mode.com/api/{workspace}/groups'
require 'http'

username = 'your_api_key'
password = 'your_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .get('https://app.mode.com/api/{workspace}/groups')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/groups', headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'GET',
  url: 'https://app.mode.com/api/{workspace}/groups',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  }}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

Create a group

To create a new group, send a POST request to the groups resource.

URL Params

workspace

required
string Workspace username
POST Body Params

Object: user_group

name

string The name for the new user group
Responses

200

UserGroup response

400

Bad request

401

Unauthorized

403

Forbidden

404

Membership not found for Workspace

POST /{workspace}/groups

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
     --data-binary "{
  \"user_group\": {
    \"name\": \"enim nostrud d\"
  }
}" \
'https://app.mode.com/api/{workspace}/groups'
require 'http'

values = {
  user_group: {
    name: 'enim nostrud d'
  }
}

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .post('https://app.mode.com/api/{workspace}/groups', json: values)
puts response
from urllib2 import Request, urlopen

values = """
  {
    "user_group": {
      "name": "enim nostrud d"
    }
  }
"""

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/groups', data=values, headers=headers)

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'POST',
  url: 'https://app.mode.com/api/{workspace}/groups',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  },
  body: "{  \"user_group\": {    \"name\": \"enim nostrud d\"  }}"
}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

Update a group

To update a group’s name, send a PATCH request including the user group attribute to the groups resource.

URL Params

workspace

required
string Workspace username

group_token

required
string UserGroup token
POST Body Params

Object: user_group

name

string The new name for the user group
Responses

200

UserGroup response

400

Bad request

401

Unauthorized

403

Forbidden

404

Membership not found for Workspace

PATCH /{workspace}/groups/{group_token}

curl --include \
     --request PATCH \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
     --data-binary "{
  \"user_group\": {
    \"name\": \"cupidatat Duis\"
  }
}" \
'https://app.mode.com/api/{workspace}/groups/{group_token}'
require 'http'

values = {
  user_group: {
    name: 'cupidatat Duis'
  }
}

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .patch('https://app.mode.com/api/{workspace}/groups/{group_token}', json: values)
puts response
from urllib2 import Request, urlopen

values = """
  {
    "user_group": {
      "name": "cupidatat Duis"
    }
  }
"""

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/groups/{group_token}', data=values, headers=headers)
request.get_method = lambda: 'PATCH'

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'PATCH',
  url: 'https://app.mode.com/api/{workspace}/groups/{group_token}',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  },
  body: "{  \"user_group\": {    \"name\": \"cupidatat Duis\"  }}"
}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});

Delete a group

To remove a group, send a DELETE request to the groups resource, specifying the group token.

URL Params

workspace

required
string Workspace username

group_token

required
string UserGroup token
Responses

200

UserGroup response

401

Unauthorized

403

Forbidden

404

Membership not found for Workspace

DELETE /{workspace}/groups/{group_token}

curl --include \
     --request DELETE \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://app.mode.com/api/{workspace}/groups/{group_token}'
require 'http'

username = 'your_api_key'
password = 'your_api_secret'

headers = {
  content_type: 'application/json',
  accept: 'application/hal+json'
}

response = HTTP.basic_auth(user: username, pass: password)
               .headers(headers)
               .delete('https://app.mode.com/api/{workspace}/groups/{group_token}')
puts response
from urllib2 import Request, urlopen

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/groups/{group_token}', headers=headers)
request.get_method = lambda: 'DELETE'

response_body = urlopen(request).read()
print(response_body)
var request = require('request');

request({
  method: 'DELETE',
  url: 'https://app.mode.com/api/{workspace}/groups/{group_token}',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/hal+json'
  }}, function (error, response, body) {
  console.log('Status:', response.statusCode);
  console.log('Headers:', JSON.stringify(response.headers));
  console.log('Response:', body);
});