Organisations

Resources across the Open Cosmos platform are grouped by organisations. An organisation is identified by a numeric ID that is required by many DataCosmos and OPS API calls.

NOTE

The Python examples on this page require the requests library.


List Organisations

Returns a paginated list of organisations that the authenticated user has access to.

GET https://app.open-cosmos.com/api/portal/v2/organisations

Query parameters

ParameterTypeRequiredDescription
limitintegerNoNumber of results to return per page.
offsetintegerNoNumber of results to skip, for pagination.
searchstringNoFilters results by organisation name.

Response

{
    "meta": {
        "paginated": true,
        "total_results": 1
    },
    "data": [
        {
            "id": 2,
            "name": "Organisation Name",
            "createdAt": "2020-04-20T15:50:54.157951Z",
            "domain": "domain.com",
            "join_policy": "JOIN"
        }
    ],
    "errors": []
}
FieldTypeDescription
meta.paginatedbooleanWhether the results are paginated.
meta.total_resultsintegerTotal number of organisations matching the query.
data[].idintegerThe numeric organisation ID used in other API calls.
data[].namestringThe human-readable name of the organisation.
data[].createdAtstringISO 8601 timestamp of when the organisation was created.
data[].domainstringThe domain associated with the organisation.
data[].join_policystringThe policy governing how users can join the organisation.
errorsarrayList of errors, if any occurred.

Bash

curl "https://app.open-cosmos.com/api/portal/v2/organisations?limit=30&offset=0" \
  --header "Authorization: Bearer ${ACCESS_TOKEN}"

To search by name:

curl "https://app.open-cosmos.com/api/portal/v2/organisations?limit=30&offset=0&search=Name" \
  --header "Authorization: Bearer ${ACCESS_TOKEN}"

Python

import requests

# Get bearer token and add to session

response = session.get(
    "https://app.open-cosmos.com/api/portal/v2/organisations",
    params={"limit": 30, "offset": 0},
)

organisations = response.json()

for org in organisations["data"]:
    print(org["id"], org["name"])

To search by name:

import requests

# Get bearer token and add to session

response = session.get(
    "https://app.open-cosmos.com/api/portal/v2/organisations",
    params={"limit": 30, "offset": 0, "search": "Name"},
)

organisations = response.json()

for org in organisations["data"]:
    print(org["id"], org["name"])

Where to Next

Common | DataCosmos