Management

Workspace Memberships

A Mode Workspace is a place where users can securely collaborate on analysis. New members get added to a Workspace when existing members or admins invite them. Learn how to invite members programmatically here.

Note: Organizations have been rebranded as Workspaces in Mode. All references to “Organizations” in the API will remain and only the Mode UI will be updated. Your current API integrations will not be impacted by this change.

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

Workspace Membership object

Properties

admin

required

boolean

invited

boolean

state

required

string

member_username

required

string

member_token

required

string

activated_at

required

string

managed_by_scim

boolean

_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.

  • groups
  • organization
  • self
  • user
  • web_self
  • web_self_approve
  • web_self_confirm_destroy
  • web_self_download_profile
  • 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 Workspace, send a GET request to memberships and include the membership token.

URL Params

workspace

required
string Workspace username

membership

required
string Membership token
Responses

200

Membership response

401

Unauthorized

404

Membership not found

GET /{workspace}/memberships/{membership}

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

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

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

request({
  method: 'GET',
  url: 'https://app.mode.com/api/{workspace}/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 Workspace, send a GET request to the memberships resource, and include the Workspace’s name as a parameter.

URL Params

workspace

required
string Workspace username
Responses

401

Unauthorized

404

Workspace not found

GET /{workspace}/memberships

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

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

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

request({
  method: 'GET',
  url: 'https://app.mode.com/api/{workspace}/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 Workspace, make a POST request to the memberships resource using the corresponding membership token.

URL Params

workspace

required
string Workspace username

membership

required
string Membership token
Responses

200

Membership response

400

Bad request

401

Unauthorized

404

Membership not found

DELETE /{workspace}/memberships/{membership}

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

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