docs: add update record section to version 1
This commit is contained in:
@@ -170,6 +170,12 @@ export const versionOne: DocsStructure = {
|
||||
copy: 'copy.md',
|
||||
example: 'example.md',
|
||||
},
|
||||
{
|
||||
title: 'Update Record',
|
||||
folder: 'update_record',
|
||||
copy: 'copy.md',
|
||||
example: 'example.md',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# Add Record {% #add-record %}
|
||||
|
||||
This endpoint allows you to add a record to an app. If the record creation was successful you will receive a `201` response.
|
||||
This endpoint allows you to add a record to an app. If the record creation was successful a `201` response will be returned.
|
||||
|
||||
## Path Parameters
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ var result = httpHelper.CreateAppRecord(195, fieldValues);
|
||||
|
||||
Console.WriteLine($"New Record Id is: {result.CreatedId}");
|
||||
|
||||
foreach (string warning in result.Warnings)
|
||||
foreach (var warning in result.Warnings)
|
||||
{
|
||||
Console.WriteLine($"Warning: {warning}");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
# Update Record {% #update-record %}
|
||||
|
||||
This endpoint allows you to update a record in an app. If the record update is successful and no warnings are encountered a `204` response will be returned with an empty body. If warnings are encountered a `200` response will be returned with the body containing the warnings encountered.
|
||||
|
||||
## Path Parameters
|
||||
|
||||
{% table %}
|
||||
|
||||
- Parameter Name
|
||||
- Data Type
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- appId
|
||||
- `number`
|
||||
- The id of the app or survey that the record will be added to.
|
||||
|
||||
---
|
||||
|
||||
- recordId
|
||||
- `number`
|
||||
- The id of the record that will be updated.
|
||||
|
||||
{% /table %}
|
||||
|
||||
## Request Body Properties
|
||||
|
||||
{% table %}
|
||||
|
||||
- Property Name
|
||||
- Data Type
|
||||
- Description
|
||||
|
||||
---
|
||||
|
||||
- FieldData
|
||||
- `object`
|
||||
- The field data to be used to update the record. 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
|
||||
|
||||
---
|
||||
|
||||
- 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,52 @@
|
||||
# Add a record in an app
|
||||
|
||||
{% code method="PUT" heading="/Records/{appId}/{recordId}" defaultLanguage="bash" %}
|
||||
|
||||
```bash
|
||||
curl --location --request PUT 'https://api.onspring.com/v1/Records/195/12' \
|
||||
--header 'Content-Type: application/json' \
|
||||
--data '{
|
||||
"FieldData": {
|
||||
"6983": "An Updated 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, "An Updated 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.UpdateAppRecord(195, 12, fieldValues);
|
||||
|
||||
foreach (var warning in result.Warnings)
|
||||
{
|
||||
Console.WriteLine($"Warning: {warning}");
|
||||
}
|
||||
```
|
||||
|
||||
{% /code %}
|
||||
|
||||
{% code heading="RESPONSE" defaultLanguage="json" %}
|
||||
|
||||
```json
|
||||
{
|
||||
"Warnings": ["A warning"]
|
||||
}
|
||||
```
|
||||
|
||||
{% /code %}
|
||||
Reference in New Issue
Block a user