docs: add get apps section

This commit is contained in:
Stevan Freeborn
2023-04-16 21:59:23 -05:00
parent 0ba9107f21
commit 587777e776
11 changed files with 158 additions and 11 deletions
@@ -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`
- The id of the app or survey.
@@ -15,25 +15,24 @@ var onspringClient = new OnspringClient(
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
import {
GetRecordsByAppIdRequest,
OnspringClient,
} from 'onspring-api-sdk';
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 request = new GetRecordsByAppIdRequest(195);
const res = await client.getRecordsByAppId(request);
const apps = res.data.items;
for (const app of apps) {