docs: add get rport by id section
This commit is contained in:
@@ -82,6 +82,12 @@ export const versionOne: DocsStructure = {
|
||||
copy: 'copy.md',
|
||||
example: 'example.md',
|
||||
},
|
||||
{
|
||||
title: 'Get Report by Id',
|
||||
folder: 'get_report_by_id',
|
||||
copy: 'copy.md',
|
||||
example: 'example.md',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# Get Report by Id {% #get-report-by-id %}
|
||||
|
||||
This endpoint returns the [Report Data](#report-data) for the given report.
|
||||
|
||||
## Path Parameters
|
||||
|
||||
{% table %}
|
||||
|
||||
- Property Name
|
||||
- Data Type
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- reportId
|
||||
- `number`
|
||||
- The id of the report.
|
||||
|
||||
{% /table %}
|
||||
|
||||
## Query Parameters
|
||||
|
||||
{% table %}
|
||||
|
||||
- Property Name
|
||||
- Data Type
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- dataFormat
|
||||
- `string`
|
||||
- The [format](#data-format) of the field data in the response. Valid values are `Raw` and `Formatted`. If not specified, `Raw` will be used.
|
||||
|
||||
---
|
||||
|
||||
- dataType
|
||||
- `string`
|
||||
- Indicate whether you want the report's report data or its chart data returned. Valid values are `ReportData` and `ChartData`. If not specified, `ReportData` will be used.
|
||||
|
||||
{% /table %}
|
||||
@@ -0,0 +1,65 @@
|
||||
# Retrieving data from a report
|
||||
|
||||
{% code method="GET" heading="/Reports/{reportId}" defaultLanguage="bash" %}
|
||||
|
||||
```bash
|
||||
curl --location 'https://api.onspring.com/Reports/613' \
|
||||
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
|
||||
```
|
||||
|
||||
```csharp
|
||||
using Onspring.API.SDK.Helpers;
|
||||
using Onspring.API.SDK.Enums;
|
||||
|
||||
var httpHelper = new HttpHelper(
|
||||
config.baseUrl,
|
||||
config.apiKey
|
||||
);
|
||||
|
||||
var reportData = httpHelper.GetReportData(
|
||||
reportId,
|
||||
ReportDataType.ChartData,
|
||||
DataFormat.Raw
|
||||
);
|
||||
|
||||
Console.WriteLine(string.Join(", ", reportData.Columns));
|
||||
|
||||
foreach (var row in reportData.Rows)
|
||||
{
|
||||
Console.WriteLine(string.Join(", ", row.Cells));
|
||||
}
|
||||
```
|
||||
|
||||
{% /code %}
|
||||
|
||||
{% code heading="RESPONSE" defaultLanguage="json" %}
|
||||
|
||||
```json
|
||||
{
|
||||
"Columns": [
|
||||
"Name",
|
||||
"Owner",
|
||||
"Due Date",
|
||||
"Status",
|
||||
"Description"
|
||||
],
|
||||
"Rows": [
|
||||
[
|
||||
"A New Test Task",
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
"<p>This is a test task.</p>"
|
||||
],
|
||||
[
|
||||
"A New Test Task",
|
||||
"Severus",
|
||||
"12/25/2021 12:00 AM",
|
||||
"In Progress",
|
||||
"<p>This is a test task.</p>"
|
||||
]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
{% /code %}
|
||||
@@ -15,7 +15,7 @@ var httpHelper = new HttpHelper(
|
||||
config.apiKey
|
||||
);
|
||||
|
||||
foreach (var report in httpHelper.GetAppReports(5))
|
||||
foreach (var report in httpHelper.GetAppReports(195))
|
||||
{
|
||||
Console.WriteLine($"{report.Id}, {report.AppId}, {report.Name}");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user