Managing Form Submissions
Page Content
This guide explains how to manage form submissions in your Zaetoon Helpdesk using the API, including retrieving, filtering, creating, updating, deleting, and restoring submissions.
Retrieve a Form Submission
To retrieve a specific form submission, send a GET request using the submission’s ID.
For example, to retrieve submission 200:
curl "https://example.com/api/agent/v1/form-submissions/200" \
-H "Authorization: Bearer $TOKEN"
Filter Form Submissions
You can filter form submissions using query parameters to retrieve records that match specific criteria.
Filter Form Submissions by Status
Use the form_submission_status_ids[] parameter to filter submissions by status.
For example, to retrieve submissions with the Open status, assuming its ID is 400:
curl "https://example.com/api/agent/v1/form-submissions?form_submission_status_ids[]=400" \
-H "Authorization: Bearer $TOKEN" \
--globoff
Filter Form Submissions by Assigned Agent
Use the assign_to[] parameter to retrieve submissions assigned to a specific agent.
For example, to retrieve submissions assigned to agent 1008:
curl "https://example.com/api/agent/v1/form-submissions?assign_to[]=1008" \
-H "Authorization: Bearer $TOKEN" \
--globoff
Filter Form Submissions by Tag
Use the tags[] parameter to filter submissions by tag.
For example, to retrieve submissions tagged “Urgent”:
curl "https://example.com/api/agent/v1/form-submissions?tags[]=urgent" \
-H "Authorization: Bearer $TOKEN" \
--globoff
Filter Form Submissions by Form
Use the form_ids[] parameter to retrieve submissions associated with a specific form.
For example, to retrieve submissions from form 1200:
curl "https://example.com/api/agent/v1/form-submissions?form_ids[]=1200" \
-H "Authorization: Bearer $TOKEN" \
--globoff
Create a Form Submission
To create a new form submission, send a POST request to the form submissions endpoint with the form ID, contact ID, and field values.
For example, the following request creates a submission for a Contact Us form with ID 1200 and associates it with contact 800.
curl "https://example.com/api/agent/v1/form-submissions" \
-X POST \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"form_id": 1200,
"contact_id": 800,
"01gzrdsyryw1w3h1jb282822w0": "Mohammed",
"01gzrdsyryw1w3h1jb2832hjk4": "Ali",
"01gzrdsyryw1w3h1ju7u9sadd8": "ali@example.com",
"01gzrdsyryw1w3h1ju1a14hyk9": "I have an urgent question about the service."
}'
The field IDs in the request body correspond to fields configured in the form. Replace them with the field IDs from your own form.
Update a Form Submission
To update an existing form submission, send a PATCH request using the submission’s ID.
For example, to change the status of submission 5000 to the status with ID 10:
curl "https://example.com/api/agent/v1/form-submissions/5000" \
-X PATCH \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"form_submission_status_id": 10
}'
Delete a Form Submission
To delete a form submission, send a DELETE request using the submission’s ID.
For example, to delete submission 5000:
curl "https://example.com/api/agent/v1/form-submissions/5000" \
-X DELETE \
-H "Authorization: Bearer $TOKEN"
Note: Deleting a form submission does not permanently remove it. The submission is moved to Deleted and can be restored later.
Restore a Deleted Form Submission
To restore a deleted form submission, send a POST request to the submission’s restore endpoint.
For example, to restore submission 5000:
curl "https://example.com/api/agent/v1/form-submissions/5000/restore" \
-X POST \
-H "Authorization: Bearer $TOKEN"
The submission will be restored to your form submissions list.