update README.md

This commit is contained in:
StevanFreeborn
2022-05-04 09:07:21 -05:00
parent d8e0f2eddc
commit 360fce2152
+78
View File
@@ -690,16 +690,94 @@ for warning in response.data.warnings:
#### Delete Records By Ids #### Delete Records By Ids
```python ```python
from Models import DeleteBatchRecordsRequest
request = DeleteBatchRecordsRequest(appId=195, recordIds=[1, 2, 3])
response = client.DeleteRecordsByIds(request)
print(f'Status Code: {response.statusCode}')
print(f'Message: {response.message}')
``` ```
### Reports ### Reports
#### Get Report By Id #### Get Report By Id
Returns the report for the provided id.
```python ```python
from Models import GetReportByIdRequest
request = GetReportByIdRequest(reportId=53)
response = client.GetReportById(request)
print(f'Status Code: {response.statusCode}')
print('Columns:')
print(f'{", ".join(response.data.columns)}')
print('Rows:')
for row in response.data.rows:
print(f'Record Id {row.recordId}: {", ".join([str(cell) for cell in row.cells])}')
```
You can also specify the format of the data in the report as well as whether you are requesting the report's data or its chart data.
```python
from Models import GetReportByIdRequest
from Enums import DataFormat, ReportDataType
request = GetReportByIdRequest(
reportId=53,
apiDataFormat=DataFormat.Formatted.name,
dataFormat=ReportDataType.ChartData.name)
response = client.GetReportById(request)
print(f'Status Code: {response.statusCode}')
print('Columns:')
print(f'{", ".join(response.data.columns)}')
print('Rows:')
for row in response.data.rows:
print(f'Record Id {row.recordId}: {", ".join([str(cell) for cell in row.cells])}')
``` ```
#### Get Reports By App Id #### Get Reports By App Id
Returns a paged collection of reports that can be paged through. By default the page size is 50 and page number is 1.
```python ```python
response = client.GetReportsByAppId(appId=195)
print(f'Status Code: {response.statusCode}')
print(f'App Id: {appId}')
print('Reports:')
for report in response.data.reports:
print(f' Id: {report.id}')
print(f' Name: {report.name}')
print(f' Description: {report.description}')
```
You can set your own page size and page number (max is 1,000) as well.
```python
from Models import PagingRequest
pagingRequest = PagingRequest(1,10)
response = client.GetReportsByAppId(appId=195, pagingRequest)
print(f'Status Code: {response.statusCode}')
print(f'Page Number: {response.data.pageNumber}')
print(f'Page Number: {response.data.pageSize}')
print(f'Page Number: {response.data.totalPages}')
print(f'Page Number: {response.data.totalRecords}')
print(f'App Id: {appId}')
print('Reports:')
for report in response.data.reports:
print(f' Id: {report.id}')
print(f' Name: {report.name}')
print(f' Description: {report.description}')
``` ```