Management

Groups

A Group is a subset of users in a Mode organization. Admins can use groups to manage access to database connections and Spaces 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 an organization. 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

_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

organization

required
string Organization username

group_token

required
string UserGroup token
Responses

200

UserGroup response

401

Unauthorized

403

Forbidden

404

Membership not found for Organization

GET /{organization}/groups/{group_token}

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

username = 'you_api_key'
password = 'you_api_secret'

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

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

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

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

request({
  method: 'GET',
  url: 'https://modeanalytics.com/api/{organization}/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 organization, send a GET request to the groups resource.

URL Params

organization

required
string Organization username
Responses

200

UserGroup collection response

401

Unauthorized

403

Forbidden

404

Membership not found for Organization

GET /{organization}/groups

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

username = 'you_api_key'
password = 'you_api_secret'

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

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

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

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

request({
  method: 'GET',
  url: 'https://modeanalytics.com/api/{organization}/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

organization

required
string Organization 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 Organization

POST /{organization}/groups

curl --include \
     --request POST \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
     --data-binary "{
  \"user_group\": {
    \"name\": \"enim nostrud d\"
  }
}" \
'https://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/groups', data=values, headers=headers)

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

request({
  method: 'POST',
  url: 'https://modeanalytics.com/api/{organization}/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

organization

required
string Organization 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 Organization

PATCH /{organization}/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://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/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

organization

required
string Organization username

group_token

required
string UserGroup token
Responses

200

UserGroup response

401

Unauthorized

403

Forbidden

404

Membership not found for Organization

DELETE /{organization}/groups/{group_token}

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

username = 'you_api_key'
password = 'you_api_secret'

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

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

headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/hal+json'
}
request = Request('https://modeanalytics.com/api/{organization}/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://modeanalytics.com/api/{organization}/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);
});