Retrieve Submission

Retrieves the json data for an existing form submission.

GET/api/restricted/form/{formId}/submission/{submissionId}
curl --request GET 'https://api.globalpatron.com/api/restricted/form/{4ee2bb21-2260-4e43-854c-94da49c13d84}/submission/{7a6197ae-fefa-4556-84fd-9b2d03a8c5ef}' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX'
Response 200 OK
{
    "form_submission": {
        "form_id": "09e76904-4a01-4141-9c21-95c1843b4dd0",
        "stale_form_name": "My form name",
        "created_by_device": {
            "client_ip_address": "111.222.33.250",
            "client_ip_country_code": "NZ"
        },
        "form_fields": [
            {
                "unique_system_name": "gpi_1696506340965",
                "submitted_value": "Kiwi"
            },
            {
                "unique_system_name": "gpi_1696506354572",
                "submitted_value": "Smith"
            },
            {
                "unique_system_name": "gpi_1696506357821",
                "submitted_value": "29 Pitt Street"
            },
            {
                "unique_system_name": "gpi_1696506366865",
                "submitted_value": "Auckland"
            },
            {
                "unique_system_name": "gpi_1696657531872",
                "submitted_value": "3"
            },
            {
                "unique_system_name": "gpi_1696657531875",
                "submitted_value": "39.99"
            }
        ],        
        "is_draft_submission": false,
        "id": "7a6197ae-fefa-4556-84fd-9b2d03a8c5ef",
        "created_date_utc": "2023-10-19T12:35:16.5832657Z",
        "modified_date_utc": "0001-01-01T00:00:00"
    },
    "attachment_details": [
        {
            "attachment": {
                "form_id": "09e76904-4a01-4141-9c21-95c1843b4dd0",
                "unsafe_original_filename": "my-image.png",
                "file_size": 2985,
                "created_by_verified_email_address": "[email protected]",
                "created_by_device": {
                    "client_ip_address": "24.25.26.27",
                    "client_ip_country_code": "AU"
                },
                "id": "2d851f52-0cba-4959-bf09-5c39c52947bf",
                "created_date_utc": "2023-10-28T12:11:54.0187273Z",
                "modified_date_utc": "0001-01-01T00:00:00"
            },
            "attachment_sas_uri": "?sv=2020-01-03&se=2020-10-27T12%3A22%3A05Z&sr=b&sp=r&sig=DfZePzAvHeOGQInCr9bgV1Mp7M%3D"
        }
    ],
    "user_has_edit_submission_access": true
}




Create Submission

Creates a new form submission

POST/api/form/{formId:guid}/submission
curl --request POST 'https://api.globalpatron.com/api/form/{80da8cb8-8aac-4911-8167-5ce887823387}/submission' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX' \
--header 'Content-Type: application/json' \
--data '{ JSON_PAYLOAD_HERE }'

Notes

In the example above, "gpi_1696241862849" is the system name of a "file upload" field on the form, and the submitted value is a pipe separated string of the Id's of all attachments that have been uploaded into that field. To upload those files and get those attachment Id's please use the Upload Submission Attachment endpoint


Response 200 OK
Example when form thanks behaviour is to show an inline message:
{
    "id": "26d168a4-ee19-4c11-9605-01680beefb64",
    "message": "Submission posted successfully",
    "thanks_behaviour": "inline_message",
    "thanks_behaviour_message": "Form submitted successfully. Thank you",
    "thanks_behaviour_redirect_parent_page": false,
    "cloud_database_post_expected_but_failed": false,
    "email_address_post_expected_but_failed": false,
    "actionSuccessful": true
}


Example when form thanks behaviour is to redirect to a different url:
{
    "id": "92eabe73-8012-406c-a742-7b2a0cce880d",
    "message": "Submission posted successfully",
    "thanks_behaviour": "url_redirect",
    "thanks_behaviour_redirect_parent_page": false,
    "thanks_behaviour_redirect_url": "https://www.your-thanks-page-url.com",
    "thanks_behaviour_redirect_url_params": [
        {
            "param_name": "param1",
            "param_value_form_field_system_name": "",
            "param_value_fixed": "john smith"
        },
        {
            "param_name": "param2",
            "param_value_form_field_system_name": "gpi_1696657530536",
            "param_value_fixed": ""
        }
    ],
    "cloud_database_post_expected_but_failed": false,
    "email_address_post_expected_but_failed": false,
    "actionSuccessful": true
}




Upload Submission Attachment

Uploads an attachment which will be later associated with a form submission

POST/api/form/{formId:guid}/submissionattachment
curl --request POST 'https://api.globalpatron.com/api/form/{80da8cb8-8aac-4911-8167-5ce887823387}/submissionattachment' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX' \
--header 'Content-Type: multipart/form-data' \
--form 'gpi_1696241862849=@"/C:/my-file-to-upload.png"'
Response 200 OK
{
    "id": "510a621c-e9db-43b9-a429-7df1b51f69a4",
    "message": "File upload succeeded",
    "action_successful": true,
    "error": ""
}

Notes

In the example response above, the "id" property contains the "id" of the newly created attachment






Retrieve Submission Attachment

Returns a secure download link to an existing submission attachment file

GET/api/restricted/form/{formId}/submissionattachment/{attachmentId}
curl --request GET 'https://api.globalpatron.com/api/restricted/form/{09e76904-4a01-4141-9c21-95c1843b4dd0}/submissionattachment/{dbf3d444-ed2c-4e0e-9e56-2bd3894207ac}' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX'
Response 200 OK
{
    "id": "https://storage.globalpatron.com:443/protected-form-attachments-09e76904-4a01-4141-9c21-95c1843b4dd0/dbf3d444-ed2c-4e0e-9e56-2bd3894207ac?sv=2023-01-03&se=2023-10-27T20%3A40%3A07Z&sr=b&sp=r&sig=fjzIEqlUxAK6572aUeGdSnZz4pd2bgqUyUQiIl5KRt4%3D",
    "message": "Temporary link to file",
    "action_successful": true,
    "error": ""
}




List Form Submissions

Get form submissions for a specific form, including temporary download tokens to allow the caller to download all form submission attachments for this form too

GET/api/restricted/form/{formId}/submissions?includeFormDefinition={optional}&dateFrom={optional}&dateTo={optional}&batchSize={optional}
Example including all optional parameters:
curl --request GET 'https://api.globalpatron.com/api/restricted/form/{09e76904-4a01-4141-9c21-95c1843b4dd0}/submissions?includeFormDefinition=1&dateFrom=1697806800000&dateTo=1698497999000&batchSize=10' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX'

Notes

In the example request above, the "dateFrom" and "dateTo" parameters expect a number representing UNIX Time milliseconds


Response 200 OK
{
    "form_definition": {
        ....
    },
    "results": [
        {
            "form_id": "09e76904-4a01-4141-9c21-95c1843b4dd0",
            "stale_form_name": "My form name",
            "created_by_verified_email_address": "[email protected]",
            "created_by_device": {
                "client_ip_address": "111.222.33.4",
                "client_ip_country_code": "NZ"
            },
            "form_fields": [
                {
                    "unique_system_name": "gpi_1696506340965",
                    "submitted_value": "2023-10-19"
                },
                {
                    "unique_system_name": "gpi_1696506254772",
                    "submitted_value": "Cables"
                },
                {
                    "unique_system_name": "gpi_1696657530536",
                    "submitted_value": "25.15"
                },
                {
                    "unique_system_name": "gpi_1696241862849",
                    "submitted_value": "370e1c4c-367c-4be6-a673-a405257d3f88|f6b25265-ede5-492c-985f-c95c78199168"
                }
            ],
            "search_words": [
                "2023-10-19",
                "cables",
                "25.15",
                "370e1c4c-367c-4be6-a673-a405257d3f88|f6b25265-ede5-492c-985f-c95c78199168"
            ],
            "is_draft_submission": false,
            "id": "92eabe73-8012-406c-a742-7b2a0cce880d",
            "created_date_utc": "2023-10-27T12:39:00.8982669Z",
            "modified_date_utc": "0001-01-01T00:00:00"
        }
    ],
    "attachments": [
        {
            "form_id": "09e76904-4a01-4141-9c21-95c1843b4dd0",
            "unsafe_original_filename": "my-picture.png",
            "file_size": 3343,
            "created_by_verified_email_address": "[email protected]",
            "created_by_device": {
                "client_ip_address": "111.222.33.4",
                "client_ip_country_code": "NZ"
            },
            "id": "dbf3d444-ed2c-4e0e-9e56-2bd3894207ac",
            "created_date_utc": "2023-10-27T12:52:33.9277387Z",
            "modified_date_utc": "0001-01-01T00:00:00"
        }
    ],
    "granted_form_roles": [
        "has_account_management",
        "has_form_editor",
        "has_form_submission",
        "has_offline_form_submission",
        "has_reporting_full"
    ],
    "container_sas_uri": "?sv=2023-01-03&se=2023-10-27T21%3A06%3A31Z&sr=c&sp=r&sig=GgKpGiJS%2FO0ItEMOvuwe0BDS%2fz6fcYNiiU%26UGY0g5rM%3D"
}




Update Submission

Updates an existing form submission

POST/api/restricted/form/{formId}/submission/{submissionId}
curl --request POST 'https://api.globalpatron.com/api/restricted/form/{80da8cb8-8aac-4911-8167-5ce887823387}/submission/{92eabe73-8012-406c-a742-7b2a0cce880d}' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX' \
--header 'Content-Type: application/json' \
--data '{ JSON_PAYLOAD_HERE }'
Response 200 OK
{
    "message": "Form submission has been updated successfully",
    "form_submission_item_updated": true
}




Delete Submission

Deletes an existing form submission.

DELETE/api/restricted/form/{formId}/submission/{submissionId}
curl --request DELETE 'https://api.globalpatron.com/api/restricted/form/{09e76904-4a01-4141-9c21-95c1843b4dd0}/submission/{92eabe73-8012-406c-a742-7b2a0cce880d}' \
--header 'TokenId: XXXXX' \
--header 'TokenSecret: XXXXX' \
Response 200 OK
{
    "message": "Form submission has been deleted successfully",
    "form_submission_item_deleted": true
}