docs: add get apps by ids section

This commit is contained in:
Stevan Freeborn
2023-04-17 08:49:43 -05:00
parent 14b54bd826
commit a880b219e0
3 changed files with 142 additions and 0 deletions
+1
View File
@@ -2,6 +2,7 @@
"typescript.tsdk": "node_modules\\typescript\\lib", "typescript.tsdk": "node_modules\\typescript\\lib",
"typescript.enablePromptUseWorkspaceTsdk": true, "typescript.enablePromptUseWorkspaceTsdk": true,
"cSpell.words": [ "cSpell.words": [
"BCDR",
"configparser", "configparser",
"DDTHH", "DDTHH",
"isnull", "isnull",
@@ -1 +1,35 @@
# Get Apps by Ids {% #get-apps-by-ids %} # Get Apps by Ids {% #get-apps-by-ids %}
This endpoint returns a batch of [apps](#apps) based on the given app ids.
## Request Body
{% code heading="REQUEST" defaultLanguage="json" %}
```json
[8, 79, 137, 193, 183]
```
{% /code %}
## Response Body Properties
{% table %}
- Property Name
- Data Type
- Description
---
- count
- `number`
- The number of apps returned.
---
- items
- `object[]`
- The [apps](#apps) returned.
{% /table %}
@@ -0,0 +1,107 @@
# Retrieve a batch of apps by ids
{% code method="POST" heading="/Apps/batch-get" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/Apps/batch-get' \
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000' \
--header 'Content-Type: application/json' \
--data '[8,79,137,193,183]'
```
```csharp
using Onspring.API.SDK;
var onspringClient = new OnspringClient(
config.BaseUrl,
config.ApiKey
);
var response = await onspringClient.GetAppsAsync(
new List<int> { 8, 79, 137, 193, 183 }
);
foreach (var app in response.Value.Items)
{
Console.WriteLine($"{app.Id}, {app.Name}");
}
```
```javascript
import { OnspringClient } from 'onspring-api-sdk';
import dotenv from 'dotenv';
dotenv.config();
const client = new OnspringClient(
process.env.BASE_URL,
process.env.API_KEY
);
const res = await client.getAppsByIds([130, 131]);
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.GetAppsByIds(appIds=[195, 240])
print(f'Status Code: {response.statusCode}')
print(f'Count: {response.data.count}')
for app in response.data.apps:
print(f'Id: {app.id}')
print(f'Name: {app.name}')
print(f'href: {app.href}')
```
{% /code %}
{% code heading="RESPONSE" defaultLanguage="json" %}
```json
{
"count": 5,
"items": [
{
"href": "https://api.onspring.dev/apps/id/8",
"id": 8,
"name": "Activated BCDR Tasks"
},
{
"href": "https://api.onspring.dev/apps/id/79",
"id": 79,
"name": "Application Assessments"
},
{
"href": "https://api.onspring.dev/apps/id/137",
"id": 137,
"name": "Applications"
},
{
"href": "https://api.onspring.dev/apps/id/193",
"id": 193,
"name": "Ascent Obligations"
},
{
"href": "https://api.onspring.dev/apps/id/183",
"id": 183,
"name": "Asset Baseline Repository"
}
]
}
```
{% /code %}