Files
onspring-api-docs/src/docs/version_002/resources/apps/get_apps/example.md
T
Stevan Freeborn 3bfaf17bf3 feat: update package dependencies and refactor Python SDK examples for consistency
- Bump versions of eslint-plugin-prettier, jest, jest-environment-jsdom, and prettier in package.json.
- Refactor Python SDK examples to use consistent naming conventions (snake_case) for method and parameter names.
- Update example responses to reflect changes in the SDK, including status code and data field names.
- Ensure all Python imports are updated to use the correct module naming.
2026-06-26 16:51:54 -05:00

2.4 KiB

Retrieve apps accessible to the API key

{% code method="GET" heading="/Apps" defaultLanguage="bash" %}

curl --location 'https://api.onspring.com/Apps' \
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
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}");
}
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.getApps();
const apps = res.data.items;

for (const app of apps) {
  console.log(app);
}
from onspring_api_sdk 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.get_apps()

print(f'Status Code: {response.status_code}')
print(f'Page Size: {response.data.page_size}')
print(f'Page Number: {response.data.page_number}')
print(f'Total Pages: {response.data.total_pages}')
print(f'Total Records: {response.data.total_records}')

for app in response.data.apps:
  print(f'Id: {app.id}')
  print(f'Name: {app.name}')
  print(f'href: {app.href}')

use onspring::{OnspringClient, PagingRequest};

let client = OnspringClient::builder(
  "000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000"
)
.build();

let paging = PagingRequest {
  page_number: 1,
  page_size: 10,
};

let response = client.list_apps(Some(paging)).await?;

for app in response.items.unwrap_or_default() {
  println!(
    "{}, {}",
    app.id,
    app.name.unwrap_or_default()
  );
}
import onspring "github.com/StevanFreeborn/onspring-api-sdk-go"

client := onspring.NewClient(
  "000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000",
)

page, _ := client.Apps.List(
  context.Background(),
)

for _, app := range page.Items {
  fmt.Printf("%d, %s\n", app.Id, app.Name)
}

{% /code %}

{% code heading="RESPONSE" defaultLanguage="json" %}

{
  "pageSize": 1,
  "pageNumber": 1,
  "totalPages": 1,
  "totalRecords": 1,
  "items": [
    {
      "id": 195,
      "name": "Tasks",
      "href": "https://api.onspring.com/Apps/195"
    }
  ]
}

{% /code %}