docs: add get record by id section

This commit is contained in:
StevanFreeborn
2023-04-24 16:06:10 -05:00
parent 08c58ba719
commit 4aa9902825
3 changed files with 101 additions and 0 deletions
+6
View File
@@ -158,6 +158,12 @@ export const versionOne: DocsStructure = {
copy: 'copy.md', copy: 'copy.md',
example: 'example.md', example: 'example.md',
}, },
{
title: 'Get Record by Id',
folder: 'get_record_by_id',
copy: 'copy.md',
example: 'example.md',
},
], ],
}, },
{ {
@@ -0,0 +1,47 @@
# Get Record by Id {% #get-record-by-id %}
This endpoint returns a single [record](#records) based on the given record id.
## Path Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- appId
- `number`
- The id of the app or survey that contains the record.
---
- recordId
- `number`
- The id of the record.
{% /table %}
## Query Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- fieldIds
- `string`
- A comma-separated list of field ids to include in the response. If not specified, all fields will be returned.
---
- dataFormat
- `string`
- The [format](#record-data-format) of the field data in the response. Valid values are `Raw` and `Formatted`. If not specified, `Raw` will be used.
{% /table %}
@@ -0,0 +1,48 @@
# Retrieving a record from an app
{% code method="GET" heading="/Records/{appId}/{recordId}" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/v1/Records/195/1?fieldIds=6976&dataFormat=Raw' \
--header 'X-ApiKey: 000000ffffff000000ffffff/00000000-ffff-0000-ffff-000000000000'
```
```csharp
using Onspring.API.SDK.Helpers;
using Onspring.API.SDK.Enums;
var httpHelper = new HttpHelper(
config.baseUrl,
config.apiKey
);
var appId = 195;
var recordId = 1;
var fieldIds = new[] {6976};
var record = httpHelper.GetAppRecord(appId, recordId, fieldIds, DataFormat.Raw);
foreach (var wrapper in record.Values.WithFieldId())
{
Console.WriteLine($"FieldId: {wrapper.FieldId}, Type: {wrapper.Value.Type}, Value: {GetResultValueString(wrapper.Value)}");
}
```
{% /code %}
{% code heading="RESPONSE" defaultLanguage="json" %}
```json
{
"AppId": 195,
"RecordId": 1,
"FieldData": [
{
"Type": 1,
"FieldId": 6976,
"Value": 1
}
]
}
```
{% /code %}