docs: add connectivity section
This commit is contained in:
@@ -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 %}
|
||||
Reference in New Issue
Block a user