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
| Parameter | Type | Required | Description |
|---|---|---|---|
limit | integer | No | Number of results to return per page. |
offset | integer | No | Number of results to skip, for pagination. |
search | string | No | Filters 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": []
}
| Field | Type | Description |
|---|---|---|
meta.paginated | boolean | Whether the results are paginated. |
meta.total_results | integer | Total number of organisations matching the query. |
data[].id | integer | The numeric organisation ID used in other API calls. |
data[].name | string | The human-readable name of the organisation. |
data[].createdAt | string | ISO 8601 timestamp of when the organisation was created. |
data[].domain | string | The domain associated with the organisation. |
data[].join_policy | string | The policy governing how users can join the organisation. |
errors | array | List 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 →