docs: add connectivity section

This commit is contained in:
Stevan Freeborn
2023-04-15 22:37:36 -05:00
parent f9abe75773
commit 0ba9107f21
3 changed files with 68 additions and 0 deletions
+6
View File
@@ -38,6 +38,12 @@ export const versionTwo: DocsStructure = {
title: 'Resources',
folder: 'resources',
children: [
{
title: 'Connectivity',
folder: 'connectivity',
copy: 'copy.md',
example: 'example.md',
},
{
title: 'Records',
folder: 'records',
@@ -0,0 +1,3 @@
# Connectivity {% #connectivity %}
This endpoint allows you to verify that you are able to connect to the Onspring API. When successful, a `200` response will be returned with no body.
@@ -0,0 +1,59 @@
# Checking for connection to the api
{% code method="GET" heading="/Ping" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/Ping' \
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
```
```csharp
using Onspring.API.SDK;
var onspringClient = new OnspringClient(
config.BaseUrl,
config.ApiKey
);
bool canConnect = await onspringClient.CanConnectAsync();
if (canConnect == true)
{
Console.WriteLine("Connected to Onspring API");
}
```
```javascript
import { OnspringClient } from 'onspring-api-sdk';
const client = new OnspringClient(
process.env.BASE_URL,
process.env.API_KEY
);
const res = await client.canConnect();
console.log(res);
```
```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)
canConnect = client.CanConnect()
if canConnect:
print('Connected successfully')
else:
print('Attempt to connect failed')
```
{% /code %}