Organizations¶
All URIs are relative to https://api.ubiops.com/v2.1
Method | HTTP request | Description |
---|---|---|
organization_users_create | POST /organizations/{organization_name}/users | Add a user to an organization |
organization_users_delete | DELETE /organizations/{organization_name}/users/{user_id} | Delete a user from an organization |
organization_users_get | GET /organizations/{organization_name}/users/{user_id} | Get details of a user in an organization |
organization_users_list | GET /organizations/{organization_name}/users | List the users in an organization |
organization_users_update | PATCH /organizations/{organization_name}/users/{user_id} | Update details of a user in an organization |
organizations_create | POST /organizations | Create organizations |
organizations_get | GET /organizations/{organization_name} | Get details of an organization |
organizations_list | GET /organizations | List organizations |
organizations_resource_usage | GET /organizations/{organization_name}/resources | Get resource usage |
organizations_update | PATCH /organizations/{organization_name} | Update details of an organization |
organizations_usage_get | GET /organizations/{organization_name}/usage | Get organization usage |
organization_users_create¶
OrganizationUserDetail organization_users_create(organization_name, data)
Add a user to an organization
Description¶
Add a user to an organization as admin or normal user. The user making the request must be admin of the organization. The user can later be assigned roles in the projects defined in the scope the organization, such as project-admin, project-viewer etc.
Required Parameters¶
-
email
: Email of the user -
admin
: Boolean value indicating whether the user is added as an admin of the organization or not
Request Examples¶
{
"email": "[email protected]",
"admin": false
}
Response Structure¶
Details of the added user
-
id
: Unique identifier for the user (UUID) -
email
: Email of the user -
name
: Name of the user -
surname
: Surname of the user -
admin
: Boolean value indicating whether the user is an admin of the organization or not
Response Examples¶
{
"id": "332d7432-2742-4177-99a9-139e91e0110c",
"email": "[email protected]",
"name": "user",
"surname": "name",
"admin": false
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
data = ubiops.OrganizationUserCreate() # OrganizationUserCreate
# Add a user to an organization
api_response = api.organization_users_create(organization_name, data)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
data | OrganizationUserCreate |
Return type¶
Authorization¶
organization_users_delete¶
organization_users_delete(organization_name, user_id)
Delete a user from an organization
Description¶
Delete a user from an organization. The user making the request must be admin of the organization. It is not possible to delete the last admin of an organization.
When a user is deleted from an organization, all his roles from all projects defined in the scope of the organization are also deleted.
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
user_id = 'user_id_example' # str
# Delete a user from an organization
api.organization_users_delete(organization_name, user_id)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
user_id | str |
Return type¶
void (empty response body)
Authorization¶
organization_users_get¶
OrganizationUserDetail organization_users_get(organization_name, user_id)
Get details of a user in an organization
Description¶
Get the details of a user in an organization. The user making the request must be admin of the organization.
Response Structure¶
Details of the user
-
id
: Unique identifier for the user (UUID) -
email
: Email of the user -
name
: Name of the user -
surname
: Surname of the user -
admin
: Boolean value indicating whether the user is an admin of the organization or not
Response Examples¶
{
"id": "332d7432-2742-4177-99a9-139e91e0110c",
"email": "[email protected]",
"name": "user",
"surname": "name",
"admin": false
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
user_id = 'user_id_example' # str
# Get details of a user in an organization
api_response = api.organization_users_get(organization_name, user_id)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
user_id | str |
Return type¶
Authorization¶
organization_users_list¶
list[OrganizationUserDetail] organization_users_list(organization_name)
List the users in an organization
Description¶
List users and their details in an organization
Response Structure¶
List of details of users
-
id
: Unique identifier for the user (UUID) -
email
: Email of the user -
name
: Name of the user -
surname
: Surname of the user -
admin
: Boolean value indicating whether the user is an admin of the organization or not
Response Examples¶
[
{
"id": "54977bc3-2c3b-4d8f-97c7-aff89a95bf21",
"email": "[email protected]",
"name": "user",
"surname": "name",
"admin": true
},
{
"id": "abe2e406-fae5-4bcf-a3bc-956d756e4ecb",
"email": "[email protected]",
"name": "user",
"surname": "name",
"admin": false
}
]
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
# List the users in an organization
api_response = api.organization_users_list(organization_name)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str |
Return type¶
Authorization¶
organization_users_update¶
OrganizationUserDetail organization_users_update(organization_name, user_id, data)
Update details of a user in an organization
Description¶
Update the admin status of a user in an organization. The user making the request must be admin of the organization. It is not possible to change the last admin of an organization to a regular user.
Required Parameters¶
admin
: Boolean value indicating whether the user is added as an admin of the organization or not
Request Examples¶
{
"admin": true
}
Response Structure¶
Details of the user
-
id
: Unique identifier for the user (UUID) -
email
: Email of the user -
name
: Name of the user -
surname
: Surname of the user -
admin
: Boolean value indicating whether the user is an admin of the organization or not
Response Examples¶
{
"id": "332d7432-2742-4177-99a9-139e91e0110c",
"email": "[email protected]",
"name": "user",
"surname": "name",
"admin": true
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
user_id = 'user_id_example' # str
data = ubiops.OrganizationUserUpdate() # OrganizationUserUpdate
# Update details of a user in an organization
api_response = api.organization_users_update(organization_name, user_id, data)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
user_id | str | |
data | OrganizationUserUpdate |
Return type¶
Authorization¶
organizations_create¶
OrganizationList organizations_create(data)
Create organizations
Description¶
Create a new organization. When a user creates an organization, s/he will automatically become an organization admin.
Required Parameters¶
-
name
: Name of the organization. The name is globally unique. It can only consist of lowercase letters, numbers and dashes (-), and must start with a lowercase letter. -
subscription
: Name of the subscription for the organization
Optional Parameters¶
subscription_end_date
: End date of the subscription. The subscription will be cancelled on this date. A 'free' subscription cannot have a custom end_date as this subscription is always valid for a year. If you are going to use a subscription other than the free subscription, you should provide the end date.
Request Examples¶
{
"name": "test-organization",
"subscription": "professional",
"subscription_end_date": "2021-03-25"
}
{
"name": "test-organization",
"subscription": "professional",
"subscription_end_date": "2021-03-25"
}
Response Structure¶
Details of the created organization
-
id
: Unique identifier for the organization (UUID) -
name
: Name of the organization -
creation_date
: Date and time the organization was created
Response Examples¶
{
"id": "abe2e406-fae5-4bcf-a3bc-956d756e4ecb",
"name": "test-organization",
"creation_date": "2020-03-25T15:43:46.101877Z"
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
data = ubiops.OrganizationCreate() # OrganizationCreate
# Create organizations
api_response = api.organizations_create(data)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
data | OrganizationCreate |
Return type¶
Authorization¶
organizations_get¶
OrganizationDetail organizations_get(organization_name)
Get details of an organization
Description¶
Get the details of an organization
Response Structure¶
Details of the organization
-
id
: Unique identifier for the organization (UUID) -
name
: Name of the organization -
creation_date
: Time the organization was created -
subscription
: Name of the subscription of the organization -
subscription_self_service
: Boolean indicating if the organization subscription is self service
Response Examples¶
{
"id": "abe2e406-fae5-4bcf-a3bc-956d756e4ecb",
"name": "test-organization",
"creation_date": "2020-03-25T15:43:46.101877Z",
"subscription": "free",
"subscription_self_service": true
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
# Get details of an organization
api_response = api.organizations_get(organization_name)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str |
Return type¶
Authorization¶
organizations_list¶
list[OrganizationList] organizations_list()
List organizations
Description¶
List all organizations where the user making the request is a member
Response Structure¶
A list of details of the organizations
-
id
: Unique identifier for the organization (UUID) -
name
: Name of the organization -
creation_date
: Date and time the organization was created
Response Examples¶
[
{
"id": "45a1f903-4146-4f15-be4a-302455cd6f7e",
"name": "organization-name",
"creation_date": "2020-03-23T11:47:15.436240Z"
}
]
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
# List organizations
api_response = api.organizations_list()
print(api_response)
# Close the connection
api_client.close()
Parameters¶
This endpoint does not need any parameter.
Return type¶
Authorization¶
organizations_resource_usage¶
ResourceUsage organizations_resource_usage(organization_name)
Get resource usage
Description¶
List the total number of resources used by this organization
Response Structure¶
A list containing the number of
-
projects
-
users
-
deployments
-
deployment_versions
-
pipelines
-
pipeline_versions
currently used by the organization.
Response Examples¶
{
"projects": 5,
"users": 3,
"deployments": 30,
"deployment_versions": 47,
"pipelines": 2,
"pipeline_versions": 4
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
# Get resource usage
api_response = api.organizations_resource_usage(organization_name)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str |
Return type¶
Authorization¶
organizations_update¶
OrganizationDetail organizations_update(organization_name, data)
Update details of an organization
Description¶
Update an organization. The user making the request must be admin of the organization. Users are able to update the name of the organization, but changes to the subscription can only be done by Dutch Analytics. To delete the end date of the current subscription, give the 'subscription_end_date' parameter with value null.
Optional Parameters¶
name
: New organization namesubscription
: New subscriptionsubscription_end_date
: End date of the new subscription. The required format isYYYY-MM-DD
. The subscription will be cancelled on this date. If you are going to update the subscription plan of the organization to a subscription other than free, you have to provide the end date.subscription_start_date
: Start date of the new subscription. The required format isYYYY-MM-DD
. The subscription will start from the provided date. If you are going to update the subscription of the organization or schedule a subscription for a time in future, you have to provide the start date.
Request Examples¶
{
"name": "new-organization-name"
}
{
"subscription": "professional",
"subscription_end_date": "2020-08-30",
"subscription_start_date": "2020-07-30"
}
{
"subscription_end_date": "2020-08-30",
"subscription_start_date": "2020-07-30"
}
Response Structure¶
Details of the organization
-
id
: Unique identifier for the organization (UUID) -
name
: Name of the organization -
creation_date
: Time the organization was created -
subscription
: Name of the subscription
Response Examples¶
{
"id": "abe2e406-fae5-4bcf-a3bc-956d756e4ecb",
"name": "test-organization",
"creation_date": "2020-03-25T15:43:46.101877Z",
"subscription": "free"
}
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
data = ubiops.OrganizationUpdate() # OrganizationUpdate
# Update details of an organization
api_response = api.organizations_update(organization_name, data)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
data | OrganizationUpdate |
Return type¶
Authorization¶
organizations_usage_get¶
list[Usage] organizations_usage_get(organization_name, start_date=start_date, end_date=end_date, interval=interval)
Get organization usage
Description¶
Get resource usage for the organization. It contains the details of each metric aggregated per month.
Optional Parameters¶
start_date
: date indicating the start date to fetch usage data from. If omitted, results are generated for current subscription period.end_date
: date indicating the end date to fetch usage data until. If omitted, results are generated for current subscription period.interval
: interval for which the usage data is fetched. It can be 'day' or 'month'. It defaults to 'month'.
If no start_date or end_date is given, the current subscription period is used, e.g. if the usage details are requested on 01-12-2020 and the subscription started on 20-11-2020, the results will contain data from 20-11-2020 to 20-12-2020. When start_date and end_date are given, this month period is used, e.g. if 12-11-2020 is given as start date and 12-12-2020 as end date, the results will contain data from 12-11-2020 to 12-12-2020.
Response Structure¶
metric
: Metric nameobject_type
: Type of object the metric was measured for (deployment_version or pipeline_version)usage
: an array of objects each containing the following:start_date
: Timestamp denoting the start of the current subscription period or the provided dateend_date
: Timestamp denoting the end of the current subscription period or the provided datevalue
: Aggregated metric value for the given unit over the given month
Response Examples¶
2019-08-01 as start date and 2019-09-01 as end date
[
{
"object_type": "deployment_version",
"metric": "credits",
"usage": [
{
"start_date": "2019-08-01T00:00:00Z",
"end_date": "2019-09-01T00:00:00Z",
"value": 1484124
}
]
},
{
"object_type": "deployment_version",
"metric": "input_volume",
"usage": [
{
"start_date": "2019-08-01T00:00:00Z",
"end_date": "2019-09-01T00:00:00Z",
"value": 1204
}
]
},
{
"object_type": "deployment_version",
"metric": "output_volume",
"usage": [
{
"start_date": "2019-08-01T00:00:00Z",
"end_date": "2019-09-01T00:00:00Z",
"value": 1598
}
]
},
{
"object_type": "pipeline_version",
"metric": "input_volume",
"usage": [
{
"start_date": "2019-08-01T00:00:00Z",
"end_date": "2019-09-01T00:00:00Z",
"value": 1840
}
]
},
{
"object_type": "pipeline_version",
"metric": "output_volume",
"usage": [
{
"start_date": "2019-08-01T00:00:00Z",
"end_date": "2019-09-01T00:00:00Z",
"value": 400
}
]
}
]
Example¶
import ubiops
configuration = ubiops.Configuration()
# Configure API token authorization
configuration.api_key['Authorization'] = 'Token <YOUR_API_TOKEN>'
# Defining host is optional and default to https://api.ubiops.com/v2.1
configuration.host = "https://api.ubiops.com/v2.1"
# Enter a context with an instance of the API client
api_client = ubiops.ApiClient(configuration)
# Create an instance of the API class
api = ubiops.CoreApi(api_client)
organization_name = 'organization_name_example' # str
start_date = str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')) # datetime (optional)
end_date = str(datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%SZ')) # datetime (optional)
interval = 'month' # str (optional) (default to 'month')
# Get organization usage
api_response = api.organizations_usage_get(organization_name, start_date=start_date, end_date=end_date, interval=interval)
print(api_response)
# Close the connection
api_client.close()
Parameters¶
Name | Type | Notes |
---|---|---|
organization_name | str | |
start_date | datetime | [optional] |
end_date | datetime | [optional] |
interval | str | [optional] [default to 'month'] |