Get the workspace

GET/workspace

Returns the workspace that the API key belongs to: its name, the number of its members and the largest number of members that it can have.

Authentication

Base URL
https://api.distito.com/workspace-v2
Header
x-api-key: <your API key>

Parameters

ParameterDescription
X-Researcher-Idstring, in header

Optional. An identifier of your own for the person that the call acts for. Distito stores it as api:<identifier> on what the call creates, and shows it as the name of the creator. A call that only reads ignores it.

Examples

Set these variables in your shell, then run an example. An example stops with an error that names each variable that you did not set.

export DISTITO_API_URL=https://api.distito.com/workspace-v2
export DISTITO_API_KEY=<your API key>
DISTITO_API_URL

The base URL of the Workspace API.

DISTITO_API_KEY

Your API key. A workspace administrator makes it on the API keys page of the web app, /app/account/api-keys/.

curl

#!/bin/sh
set -eu

: "${DISTITO_API_URL:?is not set}"
: "${DISTITO_API_KEY:?is not set}"

curl --fail-with-body --silent --show-error \
	--header "x-api-key: $DISTITO_API_KEY" \
	"$DISTITO_API_URL/workspace"

Node.js

const required = function (name) {
		const value = process.env[name];
		if (!value) {
			console.error(`${name} is not set`);
			process.exit(1);
		}
		return value;
	},
	apiUrl = required('DISTITO_API_URL'),
	apiKey = required('DISTITO_API_KEY'),
	response = await fetch(`${apiUrl}/workspace`, {
		headers: { 'x-api-key': apiKey }
	}),
	body = await response.text();
console.log(body);
if (response.status >= 400) {
	process.exitCode = 1;
}

Python

import os
import sys
import urllib.error
import urllib.request


def required(name):
    value = os.environ.get(name)
    if not value:
        sys.exit(f"{name} is not set")
    return value


api_url = required("DISTITO_API_URL")
api_key = required("DISTITO_API_KEY")

request = urllib.request.Request(
    f"{api_url}/workspace",
    headers={"x-api-key": api_key},
)
try:
    with urllib.request.urlopen(request) as response:
        print(response.read().decode())
except urllib.error.HTTPError as error:
    print(error.read().decode())
    sys.exit(1)

Responses

200 — The workspace

FieldDescription
tenantIdstringrequired

The identifier of the workspace.

displayNamestring

The name of the workspace, as its members see it in the web app.

memberCountinteger

The number of members of the workspace, invited members included.

maxMembersinteger

The largest number of members that the workspace can have.

403 — The request names no member of the workspace

FieldDescription
messagestringrequired
errorstringrequired
detailsobject
requestIdstring