Management

Organization Memberships

A Mode organization is a shared workspace that lets users securely collaborate on analysis and share database connections. New members get added to an organization when existing members or admins invite them. Learn how to invite members programatically here.

You can use the memberships resource to manage and retrieve information about members of a given organization.

Organization Membership object

Properties

admin

required

boolean

limited

boolean

state

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.

  • organization
  • self
  • user
  • web_self
  • web_self_unban
{
  "admin": false,
  "state": "amet fugiat sit velit ",
  "limited": true,
  "_links": {
    "self": {
      "href": "enim amet culpa",
      "templated": false
    },
    "web_self": {
      "href": "nulla",
      "templated": false
    },
    "web_self_unban": {
      "href": "ad elit Lorem",
      "templated": false
    },
    "organization": {
      "href": "officia",
      "templated": false
    },
    "user": {
      "href": "occaecat",
      "templated": false
    }
  },
  "_embedded": {}
}

Get a membership

To retrieve information about a member’s status in a given Mode organization, send a GET request to memberships and include the membership token.

URL Params

organization

required
string Organization username

membership

required
string Membership token
Responses

200

Membership response

401

Unauthorized

404

Membership not found

GET /{organization}/memberships/{membership}

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{organization}/memberships/{membership}'
equire 'rubygems' if RUBY_VERSION < '1.9'
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}/memberships/{membership}')
puts response
from urllib2 import Request, urlopen

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

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

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

To get a list of all members in a given Mode organization, send a GET request to the memberships resource, and include the organization’s name as a parameter.

URL Params

organization

required
string Organization username
Responses

401

Unauthorized

404

Organization not found

GET /{organization}/memberships

curl --include \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{organization}/memberships'
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}/memberships')
puts response
from urllib2 import Request, urlopen

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

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

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

Delete a membership

To remove a member from your organization, make a POST request to the memberships resource using the corresponding membership token.

URL Params

organization

required
string Organization username

membership

required
string Membership token
Responses

200

Membership response

400

Bad request

401

Unauthorized

404

Membership not found

DELETE /{organization}/memberships/{membership}

curl --include \
     --request DELETE \
     --header "Content-Type: application/json" \
     --header "Accept: application/hal+json" \
  'https://modeanalytics.com/api/{organization}/memberships/{membership}'
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}/memberships/{membership}')
puts response
from urllib2 import Request, urlopen

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