Mode Spaces API
The Spaces API from Mode — 6 operation(s) for spaces.
The Spaces API from Mode — 6 operation(s) for spaces.
swagger: '2.0'
info:
version: 0.0.1
title: Mode Account Spaces API
description: 'Mode provides a REST API for many common operations, such as:
* Listing spaces and reports
* Running reports
* Downloading query results
## Authentication
For most Mode API calls, the client must supply an API token and secret for
HTTP basic authentication.
If authentication is required for a given resource, unauthenticated requests
will result in a `401 Unauthorized` response.
[Create and Manage API Tokens](https://modeanalytics.com/settings/access_tokens)
'
termsOfService: https://mode.com/tos/
contact:
name: Mode API Team
email: support@modeanalytics.com
license:
name: MIT
host: modeanalytics.com
basePath: /api
schemes:
- https
consumes:
- application/json
produces:
- application/hal+json
security:
- accessTokenAuth: []
tags:
- name: Spaces
paths:
/{account}/spaces/{space}/datasets:
x-summary: Datasets
get:
operationId: listDatasetsInSpace
summary: List Datasets for a space
description: Returns all `Dataset`s in a `Space`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Dataset` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`Dataset` collection response'
schema:
$ref: '#/definitions/Datasets'
parameters:
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
- name: filter
in: query
description: 'Returns a filtered list of `Dataset`s in a `Space` filtered by whether their `created_at` or `updated_at` timestamps are `gt` (greater than) or `lt` (less than) the datetime passed in ISO8601 format. Example: `?filter=created_at.gt.2019-10-23T06:23:01Z` returns all `Datasets` in a space created after that date.'
required: false
type: string
- name: order
in: query
description: 'With the `order` param, returns all `Dataset`s in a `Space` ordered in `asc` or `desc` order. Example: `?order=asc&order_by=created_at`'
required: false
type: string
- name: order_by
in: query
description: 'With the `order_by` param, returns all `Dataset`s in a `Space` ordered by their `created_at` or `updated_at` timestamps. Example: `?order_by=created_at&order=asc`'
required: false
type: string
tags:
- Spaces
/{account}/spaces/{space}/reports:
x-summary: Reports
get:
operationId: listReportsInSpace
summary: List reports for a space
description: Returns all `Report`s in a `Space`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Report` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`Report` collection response'
schema:
$ref: '#/definitions/Reports'
parameters:
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
- name: filter
in: query
description: 'Returns a filtered list of `Report`s in a `Space` filtered by whether their `created_at` or `updated_at` timestamps are `gt` (greater than) or `lt` (less than) the datetime passed in ISO8601 format. Example: `?filter=created_at.gt.2019-10-23T06:23:01Z` returns all `Reports` in a space created after that date.'
required: false
type: string
- name: order
in: query
description: 'With the `order` param, returns all `Report`s in a `Space` ordered in `asc` or `desc` order. Example: `?order=asc&order_by=created_at`'
required: false
type: string
- name: order_by
in: query
description: 'With the `order_by` param, returns all `Report`s in a `Space` ordered by their `created_at` or `updated_at` timestamps. Example: `?order_by=created_at&order=asc`'
required: false
type: string
tags:
- Spaces
/{account}/spaces/{space}/memberships:
x-summary: Space Memberships
post:
operationId: createSpaceMemberships
summary: Create a space membership
description: Returns all `Memberships` for a `Space`
parameters:
- name: parameters
in: body
schema:
$ref: '#/definitions/CreateSpaceMembershipRequestBody'
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'400':
description: Bad request
schema:
$ref: '#/definitions/BadRequest'
'404':
description: '`Space` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`SpaceMembership` response'
schema:
$ref: '#/definitions/SpaceMembership'
tags:
- Spaces
get:
operationId: listSpaceMemberships
summary: List space memberships
description: Returns all `Memberships` for a `Space`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'400':
description: Bad request
schema:
$ref: '#/definitions/BadRequest'
'404':
description: '`Space` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`SpaceMembership` collection response'
schema:
$ref: '#/definitions/SpaceMemberships'
parameters:
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
tags:
- Spaces
/{account}/spaces/{space}/memberships/{space_membership}:
x-summary: Space Membership
get:
operationId: getSpaceMembership
summary: Get a space membership
description: Returns a single `Membership` for a `Space`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Space Membership` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`SpaceMembership` response'
schema:
$ref: '#/definitions/SpaceMembership'
parameters:
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
- name: space_membership
in: path
description: '`Space Membership` token'
required: true
type: string
tags:
- Spaces
delete:
operationId: deleteSpaceMembership
summary: Delete a space membership
description: Delets a single `Membership` for a `Space`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Space Membership` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`SpaceMembership` response'
schema:
$ref: '#/definitions/SpaceMembership'
parameters:
- name: account
in: path
description: '`Account` (`Workspace` or `User`) username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
- name: space_membership
in: path
description: '`Space Membership` token'
required: true
type: string
tags:
- Spaces
/{workspace}/spaces:
x-summary: Collection
get:
operationId: listCollections
summary: List Collections
description: Returns a representation of `Collection`s in a `Workspace` visible to the authenticated `User`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Workspace` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`Space` collection response'
schema:
$ref: '#/definitions/Spaces'
parameters:
- in: query
name: filter
description: 'Returns a filtered list of `Collection`s. Valid options include `all`. The default returns a list of `Collection`''s that do not include other user''s personal collections. Example: `?filter=all` returns all `Collections` including personal collections.'
required: false
type: string
- name: workspace
in: path
description: '`Workspace` username'
required: true
type: string
- name: page
in: path
description: Page of results
required: false
type: integer
- name: per_page
in: path
description: Results per page
required: false
type: integer
tags:
- Spaces
post:
operationId: createCollection
summary: Create a Collection
description: Creates a `Collection`
parameters:
- name: parameters
in: body
schema:
$ref: '#/definitions/CreateOrUpdateSpaceRequestBody'
- name: workspace
in: path
description: '`Workspace` username'
required: true
type: string
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Account` not found'
schema:
$ref: '#/definitions/NotFound'
'403':
description: Forbidden
schema:
$ref: '#/definitions/Forbidden'
'400':
description: Bad request
schema:
$ref: '#/definitions/BadRequest'
'200':
description: '`Space` response'
schema:
$ref: '#/definitions/Space'
tags:
- Spaces
/{workspace}/spaces/{space}:
x-summary: Collection
get:
operationId: getCollection
summary: Get a Collection
description: Returns a representation of a single `Collection`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Space` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`Space` response'
schema:
$ref: '#/definitions/Space'
parameters:
- name: workspace
in: path
description: '`Workspace` username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
tags:
- Spaces
delete:
operationId: deleteCollection
summary: Delete a Collection
description: Deletes a single `Collection`
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Space` not found'
schema:
$ref: '#/definitions/NotFound'
'200':
description: '`Space` response'
schema:
$ref: '#/definitions/Space'
parameters:
- name: workspace
in: path
description: '`Workspace` username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
tags:
- Spaces
post:
operationId: updateCollection
summary: Update a Collection
description: Updates a `Collection`
parameters:
- name: parameters
in: body
schema:
$ref: '#/definitions/CreateOrUpdateSpaceRequestBody'
- name: workspace
in: path
description: '`Workspace` username'
required: true
type: string
- name: space
in: path
description: '`Space` token'
required: true
type: string
responses:
'401':
description: Unauthorized
schema:
$ref: '#/definitions/Unauthorized'
'404':
description: '`Space` not found'
schema:
$ref: '#/definitions/NotFound'
'403':
description: Forbidden
schema:
$ref: '#/definitions/Forbidden'
'400':
description: Bad request
schema:
$ref: '#/definitions/BadRequest'
'200':
description: '`Space` response'
schema:
$ref: '#/definitions/Space'
tags:
- Spaces
definitions:
Reports:
properties:
pagination:
$ref: '#/definitions/Pagination'
_links:
$ref: '#/definitions/ReportsLinks'
_embedded:
$ref: '#/definitions/ReportsEmbeds'
required:
- _links
Link:
required:
- href
properties:
href:
type: string
templated:
type: boolean
default: false
BadRequest:
required:
- id
- message
properties:
id:
type: string
enum:
- bad_request
message:
type: string
SpacesLinks:
properties:
next_page:
$ref: '#/definitions/Link'
prev_page:
$ref: '#/definitions/Link'
self:
$ref: '#/definitions/Link'
required:
- self
Pagination:
required:
- first_page
- last_page
- total_pages
- total_count
properties:
first_page:
type: string
last_page:
type: string
total_pages:
type: integer
total_count:
type: integer
CreateSpaceMembershipRequestBody:
required:
- membership
type: object
properties:
membership:
required:
- member_type
- member_token
type: object
description: The attributes of the new member being added to the space
properties:
member_type:
type: string
description: The type of member, either `"User"` or `"UserGroup"`
example: User
member_token:
type: string
description: The token of the member being added
example: 2bd8236f8ae4
Forbidden:
required:
- id
- message
properties:
id:
type: string
enum:
- forbidden
message:
type: string
Unauthorized:
required:
- id
- message
properties:
id:
type: string
enum:
- unauthorized
message:
type: string
SpaceEmbeds: {}
SpacesEmbeds: {}
SpaceMemberships:
properties:
pagination:
$ref: '#/definitions/Pagination'
_links:
$ref: '#/definitions/SpaceMembershipsLinks'
_embedded:
$ref: '#/definitions/SpaceMembershipsEmbeds'
required:
- _links
ReportsEmbeds: {}
SpaceMembershipsLinks:
properties:
next_page:
$ref: '#/definitions/Link'
prev_page:
$ref: '#/definitions/Link'
self:
$ref: '#/definitions/Link'
required:
- self
SpaceMembershipEmbeds: {}
CreateOrUpdateSpaceRequestBody:
required:
- space
type: object
properties:
space:
required:
- name
type: object
description: The parameters of the new or updated space
properties:
description:
type: string
description: Description of the `space`
name:
type: string
description: Name of the `space`
NotFound:
required:
- id
- message
properties:
id:
type: string
enum:
- not_found
message:
type: string
ReportsLinks:
properties:
next_page:
$ref: '#/definitions/Link'
prev_page:
$ref: '#/definitions/Link'
self:
$ref: '#/definitions/Link'
required:
- self
SpaceMembershipLinks:
properties:
self:
$ref: '#/definitions/Link'
member:
$ref: '#/definitions/Link'
creator:
$ref: '#/definitions/Link'
required:
- self
- member
Space:
properties:
token:
type: string
id:
type: integer
space_type:
type: string
name:
type: string
description:
type: string
state:
type: string
restricted:
type: boolean
free_default:
type: string
viewable?:
type: string
viewed?:
type: string
default_access_level:
type: string
_links:
$ref: '#/definitions/SpaceLinks'
_embedded:
$ref: '#/definitions/SpaceEmbeds'
required:
- _links
- token
- id
- space_type
- name
- description
- state
- restricted
- free_default
- viewable?
SpaceMembershipsEmbeds: {}
SpaceLinks:
properties:
self:
$ref: '#/definitions/Link'
detail:
$ref: '#/definitions/Link'
space_report_pins:
$ref: '#/definitions/Link'
web:
$ref: '#/definitions/Link'
reports:
$ref: '#/definitions/Link'
creator:
$ref: '#/definitions/Link'
user_space_membership:
$ref: '#/definitions/Link'
space_memberships:
$ref: '#/definitions/Link'
preview_space_memberships:
$ref: '#/definitions/Link'
search_space_permissions:
$ref: '#/definitions/Link'
viewed:
$ref: '#/definitions/Link'
required:
- self
- detail
- reports
- search_space_permissions
SpaceMembership:
properties:
token:
type: string
member_token:
type: string
member_type:
type: string
member_id:
type: string
email:
type: string
_links:
$ref: '#/definitions/SpaceMembershipLinks'
_embedded:
$ref: '#/definitions/SpaceMembershipEmbeds'
required:
- _links
- token
- member_token
- member_type
- member_id
Spaces:
properties:
pagination:
$ref: '#/definitions/Pagination'
_links:
$ref: '#/definitions/SpacesLinks'
_embedded:
$ref: '#/definitions/SpacesEmbeds'
required:
- _links
securityDefinitions:
accessTokenAuth:
type: basic