Add or Edit Multiple Records
You can add or edit multiple board records at the same time using the BatchAddUpdateData endpoint.
| Description | Allows editing of values in board records |
|---|---|
| URL | /board/[boardname]/input/[inputviewname]/batch |
| Method | POST |
| Parameters |
|
Review the parameter definitions and examples of how to use the BatchAddUpdateData endpoint in JavaScript and C# calls.
Parameters
| Variable Name | Type | Description | Required |
|---|---|---|---|
| boardname | String | Name of the board containing the record you want to edit | True (URL) |
| inputviewname | String | Name of the view that contains the input fields for the record type you want to edit | True (URL) |
To update a record, include the dataid attribute with the data. If the dataid is not included, a new record is inserted. If the provided dataid does not exist, an error is returned for that record.
Return Value
This method returns an array of objects in the same order as the sent data.
| Property Name | Type | Description |
|---|---|---|
| dataid | Integer | ID of the record updated or added |
| success | Boolean | Whether the update/add was successful |
| error | String | If the update/add was not successful, describes the reason |
Examples
JavaScript Call
//dataObject will be different for every board. It represents a record.
var dataObject = [{
dataid: 123, // ID of the record to modify
title: 'newertitle',
}, { // No dataid, a new record will be added
title: 'newtitle',
published_date: DateTime.Now,
approval_status: 'Pending Approval',
originating_position: 'CMD EOC Director',
originating_user: 'WebEOC Administrator'
}];
var newData = {
data: JSON.stringify(dataObject)
};
await fetch(`${baseUrl}/board/Press Release/input/Input/batch`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(newData)
})
C# Call
public async Task BatchEditData()
{
using (var httpClient = new HttpClient(httpClientHandler))
{
var dataObject = new List<object> { new
{
dataid = 123, // Record will be updated title = "changed title",
}, new
{ // No dataid, a new record will be added title = "newtitle",
published_date = DateTime.Now, approval_status = "Pending Approval", originating_position = "CMD EOC Director", originating_user = "WebEOC Administrator"
} };
var serializedData = JsonConvert.SerializeObject(dataObject);
var newData = new
{
data = serializedData
};
var serializedInformation = JsonConvert.SerializeObject(newData);
await httpClient.PostAsync($"{baseUrl}/board/Press Release/input/Input/batch",
new StringContent(serializedInformation, Encoding.UTF8, "application/json"));
}
}