docs: add section on relationships
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
padding: 0 1rem;
|
padding: 0 1rem;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-color: inherit;
|
background-color: inherit;
|
||||||
|
width: 300px;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (max-width: 1000px) {
|
@media screen and (max-width: 1000px) {
|
||||||
@@ -16,6 +17,7 @@
|
|||||||
|
|
||||||
.link {
|
.link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.titleContainer {
|
.titleContainer {
|
||||||
|
|||||||
@@ -1 +1,3 @@
|
|||||||
# Dates and Times {% #dates %}
|
# Dates and Times {% #dates %}
|
||||||
|
|
||||||
|
Onspring stores date/time information in UTC (Coordinated Universal Time), and the API expects to pass UTC data back and forth. The Onspring GUI converts the UTC value to the appropriate display value depending on your instance configuration and a user's profile settings. This means that when you are working with dates and times via the API, you need to be expecting to send and receive dates in UTC.
|
||||||
|
|||||||
@@ -1 +1,25 @@
|
|||||||
# Date Example
|
# Retrieving and sending date field values
|
||||||
|
|
||||||
|
{% code heading="Date Field Value" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "Date",
|
||||||
|
"fieldId": 4800,
|
||||||
|
"value": "2023-02-15T06:00:00Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
**Note:**: The format of the date field value will be impacted based on the [data format](#data-format) sent in the request to retrieve it.
|
||||||
|
|
||||||
|
{% code heading="Value for Date Field" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"4880": "2023-02-15T06:00:00Z"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|||||||
@@ -35,8 +35,8 @@ export const versionTwo: DocsStructure = {
|
|||||||
example: 'example.md',
|
example: 'example.md',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: 'Reference Field',
|
title: 'Relationships',
|
||||||
folder: 'reference_field',
|
folder: 'relationships',
|
||||||
copy: 'copy.md',
|
copy: 'copy.md',
|
||||||
example: 'example.md',
|
example: 'example.md',
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1 +1,9 @@
|
|||||||
# Record Id {% #record-id %}
|
# Record Id {% #record-id %}
|
||||||
|
|
||||||
|
The `Record Id` is a unique identifier for a record in an Onspring app. You will use the `Record Id` to retrieve, update, and delete records. However you should not confuse this `Record Id` with the value that is held and displayed in the **Record Id** field within the Onspring GUI. The value held in the **Record Id** field is also a unique identifier for a record in an Onspring app, but it is not guaranteed to be the same as the value of the `Record Id` property returned via the API.
|
||||||
|
|
||||||
|
For the purpose of clarity it can be helpful to think of the `Record Id` value retrieved via the API as being the record's internal identifier, and the value held in the **Record Id** field as being the record's external identifier. The internal `Record Id` is the value you will want to use at all times when working with records via the API. The external **Record Id** is only useful when working with records via the Onspring GUI.
|
||||||
|
|
||||||
|
If you are ever encountering an anomaly where the data being retrieved or updated via the API does not match the data being displayed in the Onspring GUI, you will want to make sure that you are not using the **Record Id** field value to identify the record to be retrieved or updated.
|
||||||
|
|
||||||
|
**Note:** The internal `Record Id` is the value that will be used to represent records in a [reference field value](#field-values).
|
||||||
|
|||||||
@@ -1 +1,37 @@
|
|||||||
# Internal Record Id vs External Record Id
|
# Internal Record Id vs External Record Id
|
||||||
|
|
||||||
|
{% code heading="RECORD" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"appId": 130,
|
||||||
|
"recordId": 2, // Internal Record Id
|
||||||
|
"fieldData": [
|
||||||
|
{
|
||||||
|
"type": "Integer",
|
||||||
|
"fieldId": 4745,
|
||||||
|
"value": 3 // External Record Id
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="REPORT" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"columns": ["Record Id"],
|
||||||
|
"rows": [
|
||||||
|
{
|
||||||
|
"recordId": 2, // Internal Record Id
|
||||||
|
"cells": [
|
||||||
|
3 // External Record Id
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
# Reference Field
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Resolving relationships between records
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
# Relationships {% #relationships %}
|
||||||
|
|
||||||
|
Reference fields in Onspring are used to relate records to one another whether they be in the same app or in different apps. They can be used to create a one-to-one relationship, a one-to-many relationship, or a many-to-many relationship. This functionality is at the core of how people build and utilize the Onspring platform.
|
||||||
|
|
||||||
|
That being said it is likely that when you are working with data in Onspring you will need to work with data that crosses apps. For example you can have a **Groups** app that has a list of all the groups in your instance and then you can have a **Users** app that has a list of all the users in your instance. Many users can be related to a single group using a reference field. Therefore if you wanted to collect data for all the users in a group you could make use of the Onspring API to programmatically resolve the relationships between a group record and its related user records and then retrieve the data for each of those users.
|
||||||
|
|
||||||
|
You would need to first retrieve the group [record](#records) which will contain the [reference field value](#field-values) that holds all the references to the users in that group. Note the values in a reference field will be the internal [Record Id](#record-id) value for each of the related records. You would then need to confirm which app the [reference field](#reference-field) is targeting and then retrieve the user data for each of the users in the group using the user's [Record Id](#record-id) and the **Users** app id.
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
# Resolving relationships between records
|
||||||
|
|
||||||
|
{% code heading="GET GROUP RECORD" defaultLanguage="bash" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="GROUP" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="GET USERS REFERENCE FIELD" defaultLanguage="bash" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="REFERENCE FIELD" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="GET USER RECORD" defaultLanguage="bash" %}
|
||||||
|
|
||||||
|
```bash
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
|
|
||||||
|
{% code heading="USER" defaultLanguage="json" %}
|
||||||
|
|
||||||
|
```json
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
{% /code %}
|
||||||
Reference in New Issue
Block a user