From 14b54bd826a936eae9237e205a93e4fe0f6b259f Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Mon, 17 Apr 2023 08:33:31 -0500 Subject: [PATCH] docs: add get app by id section --- .../resources/apps/get_app_by_id/copy.md | 18 +++++ .../resources/apps/get_app_by_id/example.md | 71 +++++++++++++++++++ .../resources/apps/get_apps/copy.md | 2 +- .../resources/apps/get_apps/example.md | 2 +- 4 files changed, 91 insertions(+), 2 deletions(-) diff --git a/src/docs/version_002/resources/apps/get_app_by_id/copy.md b/src/docs/version_002/resources/apps/get_app_by_id/copy.md index bd0f07f..e797dbd 100644 --- a/src/docs/version_002/resources/apps/get_app_by_id/copy.md +++ b/src/docs/version_002/resources/apps/get_app_by_id/copy.md @@ -1 +1,19 @@ # 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 %} diff --git a/src/docs/version_002/resources/apps/get_app_by_id/example.md b/src/docs/version_002/resources/apps/get_app_by_id/example.md index e69de29..9eeaaaf 100644 --- a/src/docs/version_002/resources/apps/get_app_by_id/example.md +++ b/src/docs/version_002/resources/apps/get_app_by_id/example.md @@ -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 %} diff --git a/src/docs/version_002/resources/apps/get_apps/copy.md b/src/docs/version_002/resources/apps/get_apps/copy.md index 3cfa662..1a4193a 100644 --- a/src/docs/version_002/resources/apps/get_apps/copy.md +++ b/src/docs/version_002/resources/apps/get_apps/copy.md @@ -1,6 +1,6 @@ # 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 diff --git a/src/docs/version_002/resources/apps/get_apps/example.md b/src/docs/version_002/resources/apps/get_apps/example.md index 8fcb7dd..3af0c92 100644 --- a/src/docs/version_002/resources/apps/get_apps/example.md +++ b/src/docs/version_002/resources/apps/get_apps/example.md @@ -24,8 +24,8 @@ foreach (var app in response.Value.Items) ``` ```javascript -import dotenv from 'dotenv'; import { OnspringClient } from 'onspring-api-sdk'; +import dotenv from 'dotenv'; dotenv.config(); const client = new OnspringClient(