This call returns an analysis breakdown for a billing group which contains information on both the tasks and Cruncher analysis.
To find the billing_group
, use the call list billing groups to list all your billing groups.
Request
https://cgc-api.sbgenomics.com/v2/billing/groups/{billing_group}/breakdown/analysis
GET /v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis HTTP/1.1
Host: cgc-api.sbgenomics.com
X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74
curl -s -H "X-SBG-Auth-Token: 3210a98c1db9318fa9d9273156740f74" -H "content-type: application/json" - X GET "https://cgc-api.sbgenomics.com/v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis"
from sevenbridges import Api
api = Api(url='https://cgc-api.sbgenomics.com/v2',
token='3210a98c1db9318fa9d9273156740f74')
billing_group = api.billing_groups.get(
id='ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7'
)
# send GET request to SB API
breakdown = billing_group.breakdown()
print(breakdown.total_spending.currency, breakdown.total_spending.amount)
for project_breakdown in breakdown.project_breakdown:
print(project_breakdown.analysis_spending.currency,
project_breakdown.analysis_spending.amount)
print(len(project_breakdown.task_breakdown))
Header Fields
Name | Description |
---|---|
X-SBG-Auth-Token required | Your CGC authentication token. |
Path parameters
Name | Description |
---|---|
billing_group | The ID of the billing group. |
Query parameters
Name | Data type | Description |
---|---|---|
limit | integer | The maximum number of collection items to return for a single request. The default value is 50, while the maximum value is 100. This is a pagination-specific attribute. |
offset | integer | The zero-based starting index in the entire collection of the first item to return. The default value is 0. This is a pagination-specific attribute. |
fields | string | Selector specifying a subset of fields to include in the response. |
date_from | string | Specify the starting date for retrieving transactions analysis in the following format: mm-dd-yyyy. |
date_to | string | Specify the ending date for retrieving transactions analysis in the following format: mm-dd-yyyy. |
invoice_id | string | Specify Invoice ID to show a breakdown for the specific invoice. If omitted, the current spending breakdown is returned. To find the particular 'invoice_id' use the List invoices call. |
Response
See the list of specific response codes that may be contained in the body of the response.
{
"href": "https://cgc-api.sbgenomics.com/v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis?offset=0&limit=2&date_from=11-04-2020",
"items": [
{
"analysis_type": "TASK",
"analysis_id": "2ddafbe4-c305-4123-85dc-8bec448ab96b",
"project_locked": false,
"project_name": "my project",
"analysis_app_name": "Alignment Metrics QC",
"analysis_name": "Alignment Metrics QC run - 01-18-21 16:08:24",
"ran_by": "div/rfranklin",
"analysis_status": "COMPLETED",
"analysis_cost": {
"currency": "USD",
"amount": "0.024162",
"breakdown": {
"storage": "0.002312",
"computation": "0.021850",
"data_transfer_in": "0.000000"
}
},
"refunded_amount": "0.000000",
"time_started": "2021-01-18T16:08:26Z",
"time_finished": "2021-01-18T16:12:08Z"
},
{
"analysis_type": "CRUNCHER_ANALYSIS",
"analysis_id": "a1675d65-f2e9-4c5b-b1e0-48019384d4ee",
"project_locked": false,
"project_name": "my project",
"analysis_app_name": "",
"analysis_name": "an-1",
"ran_by": "div/rfranklin",
"analysis_status": "STOPPED",
"analysis_cost": {
"currency": "USD",
"amount": "0.256994",
"breakdown": {
"storage": "0.074055",
"computation": "0.182939",
"data_transfer_in": "0.000000"
}
},
"refunded_amount": "0.000000",
"time_started": "2021-01-18T16:00:27Z",
"time_finished": "2021-01-18T16:32:52Z"
},
"links": [
{
"href": "https://cgc-api.sbgenomics.com/v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis?offset=2&limit=2&date_from=11-04-2020",
"rel": "next",
"method": "GET"
}
]
}
Example of a response for a locked project
{
"href": "https://cgc-api.sbgenomics.com/v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis?offset=0&limit=1",
"items": [
{
"analysis_type": "TASK",
"analysis_id": "470cbe61-6e27-1e0e-98ad-9b51d5292177",
"project_locked": true,
"analysis_cost": {
"currency": "USD",
"amount": "0.016491",
"breakdown": {
"storage": "0.007302",
"computation": "0.009189",
"data_transfer_in": "0.000000"
}
},
"refunded_amount": "0.000000"
}
],
"links": [
{
"href": "https://cgc-api.sbgenomics.com/v2/billing/groups/ec1dc1e3-12a3-4b56-789c-e3f2dca0c6f7/breakdown/analysis?offset=1&limit=1",
"rel": "next",
"method": "GET"
}
]
}