Endpoint Overview
This endpoint allows you to add an item to a package for a specific entity via the API.
Endpoint
PUT ~/api/v2/entities/{entityId}/packages/{eventHistoryId}/items
Purpose
-
The
eventHistoryIdrefers to the ID of the created package linked to the entity. It is important to note that this is not the ID of packages existing in the application. -
The functionality of this endpoint mirrors the behavior of the dashboard.
Request Structure
Path Parameters
-
entityId: The unique identifier for the entity.
-
eventHistoryId: The ID of the package linked to the entity.
Form Data
The following data needs to be included in the request:
-
files:
-
Type: Array
-
Description: An array of items where each item is of type
document.
-
-
itemIds:
-
Type: Array
-
Description: Each element in this array is linked to a corresponding file in the
filesarray. The count of elements infilesanditemIdsmust be the same.
-
-
answers:
-
Type: Array
-
Description: Items that answer questions of type
questionare sent here. Each element in this array contains the following fields:-
itemId: The unique identifier of the question.
-
answer: The provided answer (specific format depends on the question type).
-
type: Indicates the question type. Possible values include:
-
"Discrete Choice"
-
"Text Field"
-
"Currency Field"
-
"Numerical Field"
-
"Multiple Choice"
-
"Percentage Field"
-
-
-
Example Payload
Here is an example where two files and one answer are being added:
{
"files": [
{ "document": "file1.pdf" },
{ "document": "file2.pdf" }
],
"itemIds": [
"item123",
"item124"
],
"answers": [
{
"itemId": "item125",
"answer": "42",
"type": "Numerical Field"
}
]
}
Additional Examples
Below are example payloads from real use cases:
Example 1:
-png.png?width=688&height=200&name=image%20(14)-png.png)
Example 2:
Important Notes
-
The
filesanditemIdsarrays must have the same number of elements. -
Each item in the
answersarray must correspond to a valid question.
Response
Upon success, the API will return a 200 status code along with a confirmation message or details of the added items. Error responses will provide relevant status codes and error messages to help with troubleshooting.
-png.png?width=688&height=80&name=image%20(15)-png.png)