docs: add add record section to version 1

This commit is contained in:
Stevan Freeborn
2023-04-24 19:27:40 -05:00
parent 045336b987
commit ae6abffcc2
4 changed files with 124 additions and 5 deletions
+6
View File
@@ -164,6 +164,12 @@ export const versionOne: DocsStructure = {
copy: 'copy.md',
example: 'example.md',
},
{
title: 'Add Record',
folder: 'add_record',
copy: 'copy.md',
example: 'example.md',
},
],
},
{
@@ -0,0 +1,57 @@
# Add Record {% #add-record %}
This endpoint allows you to add a record to an app.
## Path Parameters
{% table %}
- Parameter Name
- Data Type
- Description
---
- appId
- `number`
- The id of the app or survey that the record will be added to.
{% /table %}
## Request Body Properties
{% table %}
- Property Name
- Data Type
- Description
---
- FieldData
- `object`
- The field data to be included in the record when added. Each `key` should be an id of a field you want to populate and its `value` should be the value you want to place into that field.
{% /table %}
## Response Body Properties
{% table %}
- Property Name
- Data Type
- Description
---
- recordId
- `number`
- The record id of the newly created record.
---
- Warnings
- `string[]`
- A list of warnings related to the records creation. Will only be present if warnings were in fact generated by the request.
{% /table %}
@@ -0,0 +1,56 @@
# Add a record in an app
{% code method="POST" heading="/Records/{appId}" defaultLanguage="bash" %}
```bash
curl --location 'https://api.onspring.com/v1/Records/195' \
--header 'Content-Type: application/json' \
--data '{
"FieldData": {
"6983": "A New Test Task",
"6984": "This is a test task.",
"6985": "12/25/2021",
"6986: "4118d53a-9121-4345-8682-07f23d606daa",
"6987": [4]
}
}'
```
```csharp
using Onspring.API.SDK.Helpers;
var httpHelper = new HttpHelper(
config.baseUrl,
config.apiKey
);
var fieldValues = new FieldAddEditContainer();
fieldValues.Add(6983, "A New Test Task")
fieldValues.Add(6984, "This is a test task.");
fieldValues.Add(6985, "12/25/2021");
fieldValues.Add(6986, "4118d53a-9121-4345-8682-07f23d606daa");
fieldValues.Add(6987, new[] {4})
var result = httpHelper.CreateAppRecord(195, fieldValues);
Console.WriteLine($"New Record Id is: {result.CreatedId}");
foreach (string warning in result.Warnings)
{
Console.WriteLine($"Warning: {warning}");
}
```
{% /code %}
{% code heading="RESPONSE" defaultLanguage="json" %}
```json
{
"recordId": 781,
"Warnings": ["A warning"]
}
```
{% /code %}
@@ -10,11 +10,11 @@ curl --location --request PUT 'https://api.onspring.com/Records' \
"appId": 195,
"recordId": null,
"fields": {
6983: "A New Test Task",
6984: "This is a test task.",
6985: "12/25/2021",
6986: "4118d53a-9121-4345-8682-07f23d606daa",
6987: [4]
"6983": "A New Test Task",
"6984": "This is a test task.",
"6985": "12/25/2021",
"6986: "4118d53a-9121-4345-8682-07f23d606daa",
"6987": [4]
}
}'
```