docs: add get apps section
This commit is contained in:
@@ -44,6 +44,32 @@ export const versionTwo: DocsStructure = {
|
|||||||
copy: 'copy.md',
|
copy: 'copy.md',
|
||||||
example: 'example.md',
|
example: 'example.md',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Apps',
|
||||||
|
folder: 'apps',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
children: [
|
||||||
|
{
|
||||||
|
title: 'Get Apps',
|
||||||
|
folder: 'get_apps',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Get App by Id',
|
||||||
|
folder: 'get_app_by_id',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: 'Get Apps by Ids',
|
||||||
|
folder: 'get_apps_by_ids',
|
||||||
|
copy: 'copy.md',
|
||||||
|
example: 'example.md',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: 'Records',
|
title: 'Records',
|
||||||
folder: 'records',
|
folder: 'records',
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
# Apps {% #apps %}
|
||||||
|
|
||||||
|
These are objects that represent apps and/or surveys in an Onspring instance. You can retrieve a list of apps or a specific app by its Id.
|
||||||
|
|
||||||
|
## App Properties
|
||||||
|
|
||||||
|
{% table %}
|
||||||
|
|
||||||
|
- Property Name
|
||||||
|
- Data Type
|
||||||
|
- Description
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- href
|
||||||
|
- `string`
|
||||||
|
- The URL of the app.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- id
|
||||||
|
- `number`
|
||||||
|
- The id of the app.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
- name
|
||||||
|
- `string`
|
||||||
|
- The name of the app.
|
||||||
|
|
||||||
|
{% /table %}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# The App Object
|
||||||
|
|
||||||
|
{% code heading="APP" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"href": "https://api.onspring.dev/apps/id/195",
|
||||||
|
"id": 195,
|
||||||
|
"name": "Tasks"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Get App by Id {% #get-app-by-id %}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Get Apps {% #get-apps %}
|
||||||
|
|
||||||
|
This endpoint returns a [paged](#pagination) collection of [apps](#apps) that the given API key has access to.
|
||||||
|
|
||||||
|
## Query Parameters
|
||||||
|
|
||||||
|
**Note:** [Pagination](#pagination) query parameters can be used to control the number of apps returned in the response.
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
# Retrieve apps accessible to the API key
|
||||||
|
|
||||||
|
{% code method="GET" heading="/Apps" defaultLanguage="bash" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl --location 'https://api.onspring.com/Apps' \
|
||||||
|
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
|
||||||
|
```
|
||||||
|
|
||||||
|
```csharp
|
||||||
|
using Onspring.API.SDK;
|
||||||
|
|
||||||
|
var onspringClient = new OnspringClient(
|
||||||
|
config.BaseUrl,
|
||||||
|
config.ApiKey
|
||||||
|
);
|
||||||
|
|
||||||
|
var response = await onspringClient.GetAppsAsync();
|
||||||
|
|
||||||
|
foreach (var app in response.Value.Items)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{app.Id}, {app.Name}");
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
import dotenv from 'dotenv';
|
||||||
|
import { OnspringClient } from 'onspring-api-sdk';
|
||||||
|
dotenv.config();
|
||||||
|
|
||||||
|
const client = new OnspringClient(
|
||||||
|
process.env.BASE_URL,
|
||||||
|
process.env.API_KEY
|
||||||
|
);
|
||||||
|
|
||||||
|
const res = await client.getApps();
|
||||||
|
const apps = res.data.items;
|
||||||
|
|
||||||
|
for (const app of apps) {
|
||||||
|
console.log(app);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
from OnspringApiSdk.OnspringClient import OnspringClient
|
||||||
|
from configparser import ConfigParser
|
||||||
|
|
||||||
|
cfg = ConfigParser()
|
||||||
|
cfg.read('config.ini')
|
||||||
|
|
||||||
|
key = cfg['prod']['key']
|
||||||
|
url = cfg['prod']['url']
|
||||||
|
|
||||||
|
client = OnspringClient(url, key)
|
||||||
|
response = client.GetApps()
|
||||||
|
|
||||||
|
print(f'Status Code: {response.statusCode}')
|
||||||
|
print(f'Page Size: {response.data.pageSize}')
|
||||||
|
print(f'Page Number: {response.data.pageNumber}')
|
||||||
|
print(f'Total Pages: {response.data.totalPages}')
|
||||||
|
print(f'Total Records: {response.data.totalRecords}')
|
||||||
|
|
||||||
|
for app in response.data.apps:
|
||||||
|
print(f'Id: {app.id}')
|
||||||
|
print(f'Name: {app.name}')
|
||||||
|
print(f'href: {app.href}')
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
# Get Apps by Ids {% #get-apps-by-ids %}
|
||||||
@@ -12,7 +12,7 @@ These are objects representing a content record in your instance. You can create
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
- App Id
|
- appId
|
||||||
- `number`
|
- `number`
|
||||||
- The id of the app or survey.
|
- The id of the app or survey.
|
||||||
|
|
||||||
|
|||||||
@@ -15,25 +15,24 @@ var onspringClient = new OnspringClient(
|
|||||||
config.ApiKey
|
config.ApiKey
|
||||||
);
|
);
|
||||||
|
|
||||||
var response = await onspringClient.GetAppsAsync();
|
var getReportsResponse = await onspringClient.GetReportsForAppAsync(195);
|
||||||
|
|
||||||
foreach (var app in response.Value.Items)
|
foreach (var report in getReportsResponse.Value.Items)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"{app.Id}, {app.Name}");
|
Console.WriteLine($"{report.Id}, {report.AppId}, {report.Name}");
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
|
import {
|
||||||
|
GetRecordsByAppIdRequest,
|
||||||
|
OnspringClient,
|
||||||
|
} from 'onspring-api-sdk';
|
||||||
import dotenv from 'dotenv';
|
import dotenv from 'dotenv';
|
||||||
import { OnspringClient } from 'onspring-api-sdk';
|
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
const client = new OnspringClient(
|
const request = new GetRecordsByAppIdRequest(195);
|
||||||
process.env.BASE_URL,
|
const res = await client.getRecordsByAppId(request);
|
||||||
process.env.API_KEY
|
|
||||||
);
|
|
||||||
|
|
||||||
const res = await client.getApps();
|
|
||||||
const apps = res.data.items;
|
const apps = res.data.items;
|
||||||
|
|
||||||
for (const app of apps) {
|
for (const app of apps) {
|
||||||
|
|||||||
Reference in New Issue
Block a user