From f9e479d053d106adbe0c41b6d43f3e4a6d7bf98e Mon Sep 17 00:00:00 2001 From: Stevan Freeborn <65925598+StevanFreeborn@users.noreply.github.com> Date: Sat, 22 Apr 2023 15:31:06 -0500 Subject: [PATCH] docs: add data format section to version 1 --- src/app/components/Section.module.css | 9 +- src/docs/version_001/data_format/copy.md | 105 +++++++++++++++++++ src/docs/version_001/data_format/example.md | 108 ++++++++++++++++++++ src/docs/version_001/docsStructure.ts | 6 ++ 4 files changed, 226 insertions(+), 2 deletions(-) create mode 100644 src/docs/version_001/data_format/copy.md create mode 100644 src/docs/version_001/data_format/example.md diff --git a/src/app/components/Section.module.css b/src/app/components/Section.module.css index ebad336..ec64ed2 100644 --- a/src/app/components/Section.module.css +++ b/src/app/components/Section.module.css @@ -22,8 +22,13 @@ min-width: 0; width: 100%; max-width: 600px; - position: sticky; - top: 5rem; +} + +@media screen and (min-width: 1000px) { + .container>article { + position: sticky; + top: 5rem; + } } .container>article>p { diff --git a/src/docs/version_001/data_format/copy.md b/src/docs/version_001/data_format/copy.md new file mode 100644 index 0000000..414e5aa --- /dev/null +++ b/src/docs/version_001/data_format/copy.md @@ -0,0 +1,105 @@ +# Data Format {% #data-format %} + +When retrieving data via the Onspring API using certain endpoints you can specify the format of the data being retrieved. The format will be specified either in a query parameter or in the request body. These endpoints are: + +- [Get Records by App](#get-records-by-app) +- [Get Record by Id](#get-record-by-id) +- [Get Report by Id](#get-report-by-id) + +The format values can be either `Raw` or `Formatted`. If the format is not specified then the default format is `Raw`. The format specified will be applied to all the data being retrieved. The impact of the format on the data retrieve will depend on the type of field. The following tables shows the impact of the format on the data retrieved for each field type. + +## Raw Format {% #raw-format %} + +{% table %} + +- Field Type +- Return Data Type +- Description + +--- + +- AutoNumber +- `number` +- The field value will be returned as a number. + +--- + +- Date/Time +- `string` +- The field value will be returned as a string in the format `YYYY-MM-DDTHH:MM:SSZ`. + +--- + +- List +- `string` or `string[]` +- The field value will be returned as a string or an array of strings where the strings are the GUID ids of the selected list items. + +--- + +- Number +- `number` +- The field value will be returned as a number. + +--- + +- Text +- `string` +- The field value will be returned as a string including any HTML markup. + +--- + +- Time Span +- `object` +- The field value will be returned as a [Time Span](#time-span-field-value) object. + +--- + +{% /table %} + +## Formatted Format {% #formatted-format %} + +{% table %} + +- Field Type +- Return Data Type +- Description + +--- + +- AutoNumber +- `string` +- The field value will be returned as a string including any configured formatting. + +--- + +- Date/Time +- `string` +- The field value will be returned as a string including any configured formatting. + +--- + +- List +- `string` or `string[]` +- The field value will be returned as a string or an array of strings where the strings are the names of the selected list items. + +--- + +- Number +- `string` +- The field value will be returned as a string including any configured formatting. + +--- + +- Text +- `string` +- The field value will be returned as a string without any HTML markup. + +--- + +- Time Span +- `string` +- The field value will be returned as a string which represents the time span entered. + +--- + +{% /table %} diff --git a/src/docs/version_001/data_format/example.md b/src/docs/version_001/data_format/example.md new file mode 100644 index 0000000..cbb3b77 --- /dev/null +++ b/src/docs/version_001/data_format/example.md @@ -0,0 +1,108 @@ +# The Values in a Raw Response + +{% code heading="RAW" defaultLanguage="json" %} + +```json +{ + "AppId": 130, + "RecordId": 11, + "FieldData": [ + { + "Type": 1, + "FieldId": 4745, // AutoNumber Field + "Value": 11 + }, + { + "Type": 3, + "FieldId": 4800, // Date/Time Field + "Value": "2023-04-22T05:00:00Z" + }, + { + "Type": 5, + "FieldId": 4801, // Single Select List Field + "Value": "2c1af5b1-0f90-4378-b9a5-8b7e22f2bc84" + }, + { + "Type": 15, + "FieldId": 4802, // Multi Select List Field + "Value": [ + "71afe161-34f9-49d0-b45e-968b764c884c", + "d40a74dd-abb5-4fbb-82c0-5766e871e2a4" + ] + }, + { + "Type": 2, + "FieldId": 4803, // Number Field + "Value": 10.0 + }, + { + "Type": 0, + "FieldId": 4805, // Text Field + "Value": "

This is a test

" + }, + { + "Type": 4, + "FieldId": 4810, // TimeSpan Field + "Value": { + "Quantity": 1.0, + "Increment": 2, + "Recurrence": 2, + "EndByDate": null, + "EndAfterOccurrences": 1 + } + } + ] +} +``` + +{% /code %} + +# The Values in a Formatted Response + +{% code heading="RAW" defaultLanguage="json" %} + +```json +{ + "AppId": 130, + "RecordId": 11, + "FieldData": [ + { + "Type": 0, + "FieldId": 4745, // AutoNumber Field + "Value": "recordId-11" + }, + { + "Type": 0, + "FieldId": 4800, // Date/Time Field + "Value": "Saturday, April 22, 2023 5:00 AM" + }, + { + "Type": 0, + "FieldId": 4801, // Single Select List Field + "Value": "list_value_1" + }, + { + "Type": 10, + "FieldId": 4802, // Multi Select List Field + "Value": ["list_value_1", "list_value_2"] + }, + { + "Type": 0, + "FieldId": 4803, // Number Field + "Value": "$10 dollars" + }, + { + "Type": 0, + "FieldId": 4805, // Text Field + "Value": "This is a test" + }, + { + "Type": 0, + "FieldId": 4810, // TimeSpan Field + "Value": "Every 1 Second(s) End After 1 Occurrences" + } + ] +} +``` + +{% /code %} diff --git a/src/docs/version_001/docsStructure.ts b/src/docs/version_001/docsStructure.ts index ae1ebd8..9ade25d 100644 --- a/src/docs/version_001/docsStructure.ts +++ b/src/docs/version_001/docsStructure.ts @@ -16,5 +16,11 @@ export const versionOne: DocsStructure = { copy: 'copy.md', example: 'example.md', }, + { + title: 'Data Format', + folder: 'data_format', + copy: 'copy.md', + example: 'example.md', + }, ], };