diff --git a/src/docs/version_001/docsStructure.ts b/src/docs/version_001/docsStructure.ts index 74057fb..64a38ac 100644 --- a/src/docs/version_001/docsStructure.ts +++ b/src/docs/version_001/docsStructure.ts @@ -158,6 +158,12 @@ export const versionOne: DocsStructure = { copy: 'copy.md', example: 'example.md', }, + { + title: 'Get Record by Id', + folder: 'get_record_by_id', + copy: 'copy.md', + example: 'example.md', + }, ], }, { diff --git a/src/docs/version_001/resources/records/get_record_by_id/copy.md b/src/docs/version_001/resources/records/get_record_by_id/copy.md new file mode 100644 index 0000000..e3adbc4 --- /dev/null +++ b/src/docs/version_001/resources/records/get_record_by_id/copy.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 %} diff --git a/src/docs/version_001/resources/records/get_record_by_id/example.md b/src/docs/version_001/resources/records/get_record_by_id/example.md new file mode 100644 index 0000000..763a3dd --- /dev/null +++ b/src/docs/version_001/resources/records/get_record_by_id/example.md @@ -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 %}