docs: add get app by id section

This commit is contained in:
Stevan Freeborn
2023-04-17 08:33:31 -05:00
parent 1e454015cc
commit 14b54bd826
4 changed files with 91 additions and 2 deletions
@@ -1 +1,19 @@
# Get App by Id {% #get-app-by-id %} # Get App by Id {% #get-app-by-id %}
This endpoint returns a single [app](#apps) based on the given app id.
## Path Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- appId
- `number`
- The id of the app or survey.
{% /table %}
@@ -0,0 +1,71 @@
# Retrieving an app by its id
{% code method="GET" heading="/Apps/id/{appId}" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/Apps/id/195' \
--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.GetAppAsync(195);
Console.WriteLine($"{response.Value.Id}, {response.Value.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.getAppById(195);
const app = res.data;
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.GetAppById(appId=195)
print(f'Status Code: {response.statusCode}')
print(f'id: {response.data.app.id}')
print(f'Name: {response.data.app.name}')
print(f'href: {response.data.app.href}')
```
{% /code %}
{% code heading="RESPONSE" defaultLanguage="json" %}
```json
{
"id": 195,
"name": "Tasks",
"href": "https://api.onspring.com/Apps/195"
}
```
{% /code %}
@@ -1,6 +1,6 @@
# Get Apps {% #get-apps %} # Get Apps {% #get-apps %}
This endpoint returns a [paged](#pagination) collection of [apps](#apps) that the given API key has access to. This endpoint returns a [paged](#pagination) collection of [apps](#apps) that the given API key can access.
## Query Parameters ## Query Parameters
@@ -24,8 +24,8 @@ foreach (var app in response.Value.Items)
``` ```
```javascript ```javascript
import dotenv from 'dotenv';
import { OnspringClient } from 'onspring-api-sdk'; import { OnspringClient } from 'onspring-api-sdk';
import dotenv from 'dotenv';
dotenv.config(); dotenv.config();
const client = new OnspringClient( const client = new OnspringClient(