You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api-ref.md
+224-1Lines changed: 224 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1499,6 +1499,229 @@ See the `metadata_query.py` sample in the Samples directory.
1499
1499
<br>
1500
1500
<br>
1501
1501
1502
+
---
1503
+
1504
+
## Metrics
1505
+
1506
+
Using the TSC library, you can get information about all metrics on a site, update, or delete metrics.
1507
+
1508
+
<br>
1509
+
1510
+
### MetricItem class
1511
+
1512
+
```py
1513
+
MetricItem(name: Optional[str]=None)
1514
+
```
1515
+
The metrics resources for Tableau are defined in the `MetricItem` class. The class corresponds to the metric resource you can access using the Tableau Server REST API.
1516
+
1517
+
**Attributes**
1518
+
Name | Description
1519
+
:--- | :---
1520
+
`name` | Name of the metric
1521
+
`id` | The REST API id for the metric
1522
+
`description` | The description of the metric
1523
+
`webpage_url` | The URL for the metric
1524
+
`created_at` | The datetime object for when the metric was created
1525
+
`updated_at` | The datetime object for when the metric was updated
1526
+
`suspended` | Boolean for if the metric is in a suspended state
1527
+
`project_id` | REST API id for the project containing the metric
1528
+
`project_name` | The name of the project containing the metric
1529
+
`owner_id` | REST API id for the user who owns the metric
1530
+
`view_id` | REST API id for the view from which the metric was created
1531
+
1532
+
1533
+
1534
+
Source file: models/metric_item.py
1535
+
1536
+
<br>
1537
+
<br>
1538
+
1539
+
### Metric methods
1540
+
1541
+
The metric methods are based upon the endpoints for metrics in the REST API and operate on the `MetricItem` class. The metrics endpoint also supports the django style filtering.
1542
+
See [Filter and Sort](filter-sort) for more information.
1543
+
1544
+
Source files: server/endpoint/metrics_endpoint.py
1545
+
1546
+
<br>
1547
+
<br>
1548
+
1549
+
#### metrics.delete
1550
+
1551
+
```py
1552
+
metrics.delete(metric_id)
1553
+
1554
+
```
1555
+
1556
+
Deletes a metric item from a site.
1557
+
1558
+
1559
+
To specify the site, create a `TableauAuth` instance using the content URL for the site (`site_id`), and sign in to that site. See the [TableauAuth class](#tableauauth-class).
To specify the site, create a `TableauAuth` instance using the content URL for the site (`site_id`), and sign in to that site. See the [TableauAuth class](#tableauauth-class).
1603
+
1604
+
REST API: [List Metrics for Site](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref.htm#list_metrics_for_site)
1605
+
1606
+
1607
+
**Parameters**
1608
+
1609
+
None.
1610
+
1611
+
**Returns**
1612
+
1613
+
Returns a Tuple containing a list of all `MetricItem` objects and a `PaginationItem`. Use these values to iterate through the results.
print([metric.name for metric in all_metric_items])
1628
+
1629
+
```
1630
+
1631
+
<br>
1632
+
<br>
1633
+
1634
+
#### metrics.get_by_id
1635
+
1636
+
```py
1637
+
metrics.get_by_id(metric_id)
1638
+
1639
+
```
1640
+
1641
+
Return a specific metric item from the site.
1642
+
1643
+
1644
+
To specify the site, create a `TableauAuth` instance using the content URL for the site (`site_id`), and sign in to that site. See the [TableauAuth class](#tableauauth-class).
To specify the site, create a `TableauAuth` instance using the content URL for the site (`site_id`), and sign in to that site. See the [TableauAuth class](#tableauauth-class).
`name` | The name of the site. The name of the default site is "".
2839
3062
`content_url` | The path to the site.
2840
3063
`admin_mode` | (Optional) For Tableau Server only. Specify `ContentAndUsers` to allow site administrators to use the server interface and **tabcmd** commands to add and remove users. (Specifying this option does not give site administrators permissions to manage users using the REST API.) Specify `ContentOnly` to prevent site administrators from adding or removing users. (Server administrators can always add or remove users.)
2841
-
`user_quota`| (Optional) Specifies the maximum number of users for the site. If you do not specify this value, the limit depends on the type of licensing configured for the server. For user-based license, the maximum number of users is set by the license. For core-based licensing, there is no limit to the number of users. If you specify a maximum value, only licensed users are counted and server administrators are excluded.
3064
+
`user_quota`| (Optional) Specifies the maximum number of users for the site. If you do not specify this value, the limit depends on the type of licensing configured for the server. For user-based license, the maximum number of users is set by the license. For core-based licensing, there is no limit to the number of users. If you specify a maximum value, only licensed users are counted and server administrators are excluded. Mutually exclusive with tiered license level settings.
2842
3065
`storage_quota` | (Optional) Specifies the maximum amount of space for the new site, in megabytes. If you set a quota and the site exceeds it, publishers will be prevented from uploading new content until the site is under the limit again.
2843
3066
`disable_subscriptions` | (Optional) Specify `true` to prevent users from being able to subscribe to workbooks on the specified site. The default is `false`.
2844
3067
`subscribe_others_enabled` | (Optional) Specify `false` to prevent server administrators, site administrators, and project or content owners from being able to subscribe other users to workbooks on the specified site. The default is `true`.
0 commit comments