docs: add data format section to version 1

This commit is contained in:
Stevan Freeborn
2023-04-22 15:31:06 -05:00
parent a8d160b340
commit f9e479d053
4 changed files with 226 additions and 2 deletions
+7 -2
View File
@@ -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 {
+105
View File
@@ -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 %}
+108
View File
@@ -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": "<p>This is a test</p>"
},
{
"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 %}
+6
View File
@@ -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',
},
],
};