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
* Update docs with maxage info
Docs for #635 and #639
* Addresses feedback for request options part of docs
* Addresses remaining feedback to view and workbook methods
Copy file name to clipboardExpand all lines: docs/api-ref.md
+71-13Lines changed: 71 additions & 13 deletions
Original file line number
Diff line number
Diff line change
@@ -1595,9 +1595,15 @@ Name | Description
1595
1595
### CSVRequestOptions class
1596
1596
1597
1597
```py
1598
-
CSVRequestOptions()
1598
+
CSVRequestOptions(maxage=-1)
1599
1599
```
1600
-
Use this class to specify view filters to be applied when the CSV data is generated. See `views.populate_csv`.
1600
+
Use this class to specify view filters to be applied when the CSV data is generated. Optionally, you can specify the maximum age of the CSV data cached on the server by providing a `maxage` value. See `views.populate_csv`.
1601
+
1602
+
**Attributes**
1603
+
1604
+
Name | Description
1605
+
:--- | :---
1606
+
`maxage` | Optional. The maximum number of minutes the CSV data will be cached on the server before being refreshed. The value must be an integer between `1` and `240` minutes. `0` will be interpreted as 1 minute on server, as that is the shortest interval allowed. By default, `maxage` is set to `-1`, indicating the default behavior configured in server settings.
1601
1607
1602
1608
**Example**
1603
1609
@@ -1607,7 +1613,7 @@ Use this class to specify view filters to be applied when the CSV data is genera
Use this class to specify the resolution of the view returned as an image. You can also use this class to specify view filters to be applied when the image is generated. See `views.populate_image`.
1629
+
Use this class to specify the resolution of the view and, optionally, the maximum age of the image cached on the server. You can also use this class to specify view filters to be applied when the image is generated. See `views.populate_image`.
1624
1630
1625
1631
**Attributes**
1626
1632
1627
1633
Name | Description
1628
1634
:--- | :---
1629
1635
`imageresolution` | The resolution of the view returned as an image. You set this option with the `Resolution` class. If unspecified, the `views.populate_image` method returns an image with standard resolution (the width of the returned image is 784 pixels). If you set this parameter value to high (`Resolution.High`), the width of the returned image is 1568 pixels. For both resolutions, the height varies to preserve the aspect ratio of the view.
1636
+
`maxage` | Optional. The maximum number of minutes the image will be cached on the server before being refreshed. The value must be an integer between `1` and `240` minutes. `0` will be interpreted as 1 minute on server, as that is the shortest interval allowed. By default, `maxage` is set to `-1`, indicating the default behavior configured in server settings.
1630
1637
1631
1638
**View Filters**
1632
1639
@@ -1640,7 +1647,7 @@ You can use the `vf('filter_name', 'filter_value')` method to add view filters.
Use this class to specify the format of the PDF that is returned for the view. See `views.populate_pdf`.
1665
+
Use this class to specify the format of the PDF that is returned for the view. Optionally, you can specify the maximum age of the rendered PDF that is cached on the server by providing a `maxage` value. See `views.populate_pdf`.
1659
1666
1660
1667
**Attributes**
1661
1668
1662
1669
Name | Description
1663
1670
:--- | :---
1664
1671
`page_type` | The type of page returned in PDF format for the view. The page_type is set using the `PageType` class: <br> `PageType.A3`<br> `PageType.A4`<br> `PageType.A5`<br> `PageType.B5`<br> `PageType.Executive`<br> `PageType.Folio`<br> `PageType.Ledger`<br> `PageType.Legal`<br> `PageType.Letter`<br> `PageType.Note`<br> `PageType.Quarto`<br> `PageType.Tabloid`
1665
1672
`orientation` | The orientation of the page. The options are portrait and landscape. The options are set using the `Orientation` class: <br>`Orientation.Portrait`<br> `Orientation.Landscape`
1673
+
`maxage` | Optional. The maximum number of minutes the rendered PDF will be cached on the server before being refreshed. The value must be an integer between `1` and `240` minutes. `0` will be interpreted as 1 minute on server, as that is the shortest interval allowed. By default, `maxage` is set to `-1`, indicating the default behavior configured in server settings.
1666
1674
1667
1675
**View Filters**
1668
1676
You can use the `vf('filter_name', 'filter_value')` method to add view filters. When the PDF is generated, the specified filters will be applied to the view.
@@ -1675,7 +1683,9 @@ You can use the `vf('filter_name', 'filter_value')` method to add view filters.
@@ -3259,7 +3269,7 @@ This endpoint is available with REST API version 2.5 and up.
3259
3269
Name | description
3260
3270
:--- | :---
3261
3271
`view_item` | Specifies the view to populate.
3262
-
`req_options` | (Optional) You can pass in a request object to specify a high resolution image. By default, the image will be in low resolution. You can also specify view filters to be applied when the image is generated. See [ImageRequestOptions class](#imagerequestoptions-class) for more details.
3272
+
`req_options` | (Optional) You can pass in request options to specify the image resolution and the maximum age of the view image cached on the server. By default, the image will be in low resolution. The maximum image cache time is the value of `maxage` in minutes, and must be an integer between 1 and 240. A value of zero will cause the minimum cache time of 1 minute. A value of -1 will cache images for the time configured in server settings. You can also specify view filters to be applied when the image is generated. See [ImageRequestOptions class](#imagerequestoptions-class) for more details.
3263
3273
3264
3274
**Exceptions**
3265
3275
@@ -3306,7 +3316,7 @@ This endpoint is available with REST API version 2.7 and up.
3306
3316
Name | description
3307
3317
:--- | :---
3308
3318
`view_item` | Specifies the view to populate.
3309
-
`req_options` | (Optional) You can pass in a request object to specify view filters to be applied when the CSV data is generated. See [CSVRequestOptions class](#csvrequestoptions-class) for more details.
3319
+
`req_options` | (Optional) You can pass in request options to specify the maximum age of the CSV cached on the server. The maximum CSV cache time is the value of `maxage` in minutes, and must be an integer between 1 and 240. A value of zero will cause the minimum cache time of 1 minute. A value of -1 will cache CSV files for the time configured in server settings. You can also specify view filters to be applied when the data is generated. See [CSVRequestOptions class](#csvrequestoptions-class) for more details.
@@ -3354,7 +3364,7 @@ This endpoint is available with REST API version 2.7 and up.
3354
3364
Name | description
3355
3365
:--- | :---
3356
3366
`view_item` | Specifies the view to populate.
3357
-
`req_options` | (Optional) You can pass in a request object to specify the page type and orientation of the PDF content. If not specified, PDF content will have default page type and orientation. You can also specify view filters to be applied when the PDF is generated. See [PDFRequestOptions class](#pdfrequestoptions-class) for more details.
3367
+
`req_options` | (Optional) You can pass in request options to specify the page type and orientation of the PDF content, as well as the maximum age of the PDF rendered on the server. If not specified, PDF content will have default page type and orientation. The maximum PDF cache time is the value of `maxage` in minutes, and must be an integer between 1 and 240. A value of zero will cause the minimum cache time of 1 minute. A value of -1 will cache PDF files for the time configured in server settings. You can also specify view filters to be applied when the PDF is generated. See [PDFRequestOptions class](#pdfrequestoptions-class) for more details.
3358
3368
3359
3369
**Exceptions**
3360
3370
@@ -3995,6 +4005,9 @@ None. The preview image is added to the view.
This endpoint is available with REST API version 3.4 and up.
4072
+
4073
+
**Parameters**
4074
+
4075
+
Name | description
4076
+
:--- | :---
4077
+
`workbook_item` | Specifies the workbook to populate.
4078
+
`req_options` | (Optional) You can pass in request options to specify the page type and orientation of the PDF content, as well as the maximum age of the PDF rendered on the server. If not specified, PDF content will have default page type and orientation. The maximum PDF cache time is the value of `maxage` in minutes, and must be an integer between 1 and 240. A value of zero will cause the minimum cache time of 1 minute. A value of -1 will cache PDF files for the time configured in server settings. See [PDFRequestOptions class](#pdfrequestoptions-class) for more details.
4079
+
4080
+
**Exceptions**
4081
+
4082
+
Error | Description
4083
+
:--- | :---
4084
+
`Workbook item missing ID` | Raises an error if the ID of the workbook is missing.
4085
+
4086
+
**Returns**
4087
+
4088
+
None. The PDF content is added to the `workbook_item` and can be accessed by its `pdf` field.
4089
+
4090
+
**Example**
4091
+
```py
4092
+
# Sign in, get view, etc.
4093
+
4094
+
# Populate and save the workbook pdf as 'workbook_pdf.pdf'
0 commit comments