Management
Space Memberships
The Space Memberships endpoint is no longer used to manage access to Collections and Reports. For more information on how to manage permissions via the API go here. The Space Memberships endpoint will be deprecated on 9/30.
Space Membership is an object representing user membership in a Mode Collection. A Collection is a place for Mode users to gather reports related to a team, project, or common theme.
You can use the spaces membership resource to get information about or manage membership in a given Collection.
Please note that an Workspace may have different types of Collections depending on their Mode plan.
Note: Spaces have been rebranded as Collections in Mode, but the API will continue to refer to spaces
. The spaces object and resources are the same as Collections in the Mode UI.
Space Membership object
Properties | |
token required |
string |
member_token required |
string |
member_type required |
string |
member_id required |
string |
|
string |
_links required |
object |
Links
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
- member
- self
"token": "gbhnjuim5yb",
"member_token": "fgbnhtum6j5h",
"member_type": "in id commodo ipsum",
"member_id": 1019,
"email": "outer.space@example.com",
{
"_links": {
"self": {
"href": "dolore ex",
"templated": false
},
"member": {
"href": "eu non aute velit officia",
"templated": false
},
"creator": {
"href": "minim",
"templated": false
}
},
"_embedded": {}
}
Get a space membership
To retrieve information about a given member of a Collection, send a GET request to the space memberships resource with a membership_token
.
Note: Spaces have been rebranded as Collections in Mode, but the API will continue to refer to spaces
. The spaces object and resources are the same as Collections in the Mode UI.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
space required |
string |
Space token
|
space_membership required |
string | Space Membership token |
Responses | |
200 |
SpaceMembership response |
401 |
Unauthorized |
404 |
Space Membership not found |
GET
/{account}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_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)
.get('https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_membership}')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_membership}', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_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 space memberships
To retrieve a list of all memberships in a given Collection, send a GET request to the space memberships resource.
Note: Spaces have been rebranded as Collections in Mode, but the API will continue to refer to spaces
. The spaces object and resources are the same as Collections in the Mode UI.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
space required |
string |
Space token
|
Responses | |
200 |
SpaceMembership collection response |
400 |
Bad request |
401 |
Unauthorized |
404 |
Space not found |
GET
/{account}
curl --include \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/spaces/{space}/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/{account}/spaces/{space}/memberships')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/spaces/{space}/memberships', headers=headers)
response_body = urlopen(request).read()
print(response_body)
var request = require('request');
request({
method: 'GET',
url: 'https://app.mode.com/api/{account}/spaces/{space}/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);
});
Create a space membership
To add a user to a given Collection, send a POST request to the space memberships resource.
Note: Spaces have been rebranded as Collections in Mode, but the API will continue to refer to spaces
. The spaces object and resources are the same as Collections in the Mode UI.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
space required |
string |
Space token
|
POST Body Params
Object: |
||
member_type required |
string |
The type of member, either "User" or "UserGroup"
Example:
|
member_token required |
string |
The token of the member being added
Example:
|
Responses | |
200 |
SpaceMembership response |
400 |
Bad request |
401 |
Unauthorized |
404 |
Space not found |
POST
/{account}
curl --include \
--request POST \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
--data-binary "{
\"space\": {
\"space_type\": \"Excepteur dolor officia ex\",
\"name\": \"irure eiusmod labore\",
\"description\": \"est reprehenderit ad ullamco\"
}
}" \
'https://app.mode.com/api/{workspace}/spaces'
require 'http'
values = {
space: {
space_type: 'Excepteur dolor officia ex',
name: 'irure eiusmod labore',
description: 'est reprehenderit ad ullamco'
}
}
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}/spaces', json: values)
puts response
from urllib2 import Request, urlopen
values = """
{
"space": {
"space_type": "Excepteur dolor officia ex",
"name": "irure eiusmod labore",
"description": "est reprehenderit ad ullamco"
}
}
"""
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{workspace}/spaces', 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}/spaces',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
},
body: "{ \"space\": { \"space_type\": \"Excepteur dolor officia ex\", \"name\": \"irure eiusmod labore\", \"description\": \"est reprehenderit ad ullamco\" }}"
}, function (error, response, body) {
console.log('Status:', response.statusCode);
console.log('Headers:', JSON.stringify(response.headers));
console.log('Response:', body);
});
Delete a space membership
To remove a user from a Collection, send a DELETE request to the space memberships resource.
Note: Spaces have been rebranded as Collections in Mode, but the API will continue to refer to spaces
. The spaces object and resources are the same as Collections in the Mode UI.
URL Params | ||
account required |
string |
Account (Workspace or User ) username
|
space required |
string |
Space token
|
space_membership required |
string | Space Membership token |
Responses | |
200 |
SpaceMembership response |
401 |
Unauthorized |
404 |
Space Membership not found |
DELETE
/{account}
curl --include \
--request DELETE \
--header "Content-Type: application/json" \
--header "Accept: application/hal+json" \
'https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_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/{account}/spaces/{space}/memberships/{space_membership}')
puts response
from urllib2 import Request, urlopen
headers = {
'Content-Type': 'application/json',
'Accept': 'application/hal+json'
}
request = Request('https://app.mode.com/api/{account}/spaces/{space}/memberships/{space_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/{account}/spaces/{space}/memberships/{space_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);
});