Skip to content

Commit 95c5766

Browse files
authored
Add docs for schedules batch update (#1731)
Add docs for the schedules.batch_update_status method added by @jorwoods in #1714.
1 parent c01d191 commit 95c5766

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

docs/api-ref.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3614,6 +3614,53 @@ monthly_schedule = TSC.ScheduleItem("Monthly-Schedule",
36143614
monthly_schedule = server.schedules.create(monthly_schedule)
36153615
```
36163616

3617+
#### schedules.batch_update_state
3618+
3619+
```py
3620+
schedules.batch_update_state(schedules, state, update_all=False)
3621+
```
3622+
3623+
Batch update the status of one or more schedules. If `update_all` is set to `True`, all schedules on the Tableau Server are affected.
3624+
3625+
REST API: [Batch Update Schedule State](https://help.tableau.com/current/api/rest_api/en-us/REST/rest_api_ref_jobs_tasks_and_schedules.htm#batch_update_schedule_state)
3626+
3627+
**Version**
3628+
3629+
This endpoint is available with REST API version 3.27 and up.
3630+
3631+
**Parameters**
3632+
3633+
| Name | Description |
3634+
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
3635+
| `schedules` | (Optional) An iterable of `ScheduleItem` objects or schedule ID strings to be updated. If `update_all=True`, this parameter is ignored. |
3636+
| `state` | The state to set for the schedules. Must be either `"active"` or `"suspended"`. |
3637+
| `update_all` | (Optional) If set to `True`, applies the state to all schedules on the server. Defaults to `False`. |
3638+
3639+
**Returns**
3640+
3641+
A list of strings containing the IDs of the affected schedules.
3642+
3643+
**Example**
3644+
3645+
```py
3646+
import tableauserverclient as TSC
3647+
# sign in, etc.
3648+
3649+
# Get schedules to update
3650+
schedules, pagination = server.schedules.get()
3651+
schedules_to_update = [schedules[0], schedules[1], schedules[2]]
3652+
3653+
# Batch update schedules to active state
3654+
affected_ids = server.schedules.batch_update_state(schedules_to_update, "active")
3655+
3656+
# Or update using schedule ID strings
3657+
schedule_ids = ["593d2ebf-0d18-4deb-9d21-b113a4902583",
3658+
"cecbb71e-def0-4030-8068-5ae50f51db1c"]
3659+
affected_ids = server.schedules.batch_update_state(schedule_ids, "suspended")
3660+
3661+
# Update all schedules on the server
3662+
all_affected_ids = server.schedules.batch_update_state([], "active", update_all=True)
3663+
```
36173664

36183665

36193666
<br>

0 commit comments

Comments
 (0)