Using forms

Forms are always linked to a ticket. Each ticket can contain one (not multiple) forms. Triggers, crons or API actions can specify which type of form belongs to the ticket.

Get available forms (list)

GET https://account.omnidesk.com/api/v2/form

{
    type: "itemList",
    itemStart: 0,
    itemTotal: 2,
    itemLimit: 15,
    items: [
        {
            id: 1,
            brandName: "Jupiter",
            title: "form1",
            name: "form1"
        },
        {
            id: 2,
            brandName: "Jupiter",
            title: "form2",
            name: "form2"
        }
    ]
}

Get all information of a form

GET https://account.omnidesk.com/api/v2/form/1

No further parameters required in the request. Just specify the form id in the path to get information on the form, like the fields it contains.

{
    type: "item",
    item: {
        id: 1,
        title: "form1",
        brandID: 1,
        fields: [
            {
                id: 1,
                formID: 1,
                inputType: "select",
                title: "product",
                defaultValue: "",
                required: false,
                formFieldOptionIDCondition: null,
                options: [
                    {
                        id: 2,
                        formFieldID: 1,
                        title: "postpaid",
                        formFieldOptionIDCondition: null
                    },
                    {
                        id: 1,
                        formFieldID: 1,
                        title: "prepaid",
                        formFieldOptionIDCondition: null
                    }
                ]
            },
            {
                id: 2,
                formID: 1,
                inputType: "text",
                title: "title of the product",
                defaultValue: "",
                required: true,
                formFieldOptionIDCondition: 2
            },
            {
                id: 3,
                formID: 1,
                inputType: "select",
                title: "field2",
                defaultValue: "",
                required: false,
                formFieldOptionIDCondition: null,
                options: [
                    {
                        id: 3,
                        formFieldID: 3,
                        title: "prepaid cool",
                        formFieldOptionIDCondition: 1
                    }
                ]
            }
        ]
    }
}

This might be the moment you want to create a ticket and specify what type of form you want to use for the ticket. See the ticket documentation. For the next step you can use the ticket ID in the response to save form fields to the ticket.

Save form field

PUT https://account.omnidesk.com/api/v2/form/saveFormFields

This endpoint allows you to save content to a form.

Request Body

NameTypeDescription

fields[1]['formFieldValue']

string

value2

fields[1]['formFieldID']

integer

15

fields[0]['formFieldValue']

string

value1

fields[0]['formFieldID']

integer

12

ticketID

integer

{
    "type": "result",
    "status": "success",
    "message": "Form field saved."
}

Get ticket form field values

GET https://account.omnidesk.com/api/v2/form/getFormForTicket?ticketID=1

This endpoint will return the form field information from a single ticket. The data that was filled in can be found in two different keys: - For select fields (dropdown fields) it can be found under they key "selectedFields" - For other fields (text fields etc) it can be found under the key "values" For the selectedFields the formFieldID will match the formFieldID's under fields.options.

Path Parameters

NameTypeDescription

ticketID

integer

{
    "type": "item",
    "item": {
        "id": 1,
        "title": "Assign to view",
        "brandID": 1,
        "channelID": 0,
        "fields": [
            {
                "id": 1,
                "formID": 1,
                "inputType": "select",
                "title": "Type Klant",
                "defaultValue": "",
                "required": false,
                "formFieldOptionIDCondition": null,
                "fieldOrder": 1,
                "externalCode": null,
                "options": [
                    {
                        "id": 2,
                        "formFieldID": 13,
                        "title": "Bedrijf",
                        "formFieldOptionIDCondition": null
                    },
                    {
                        "id": 3,
                        "formFieldID": 13,
                        "title": "Klant",
                        "formFieldOptionIDCondition": null
                    }
                ]
            },
            {
                "id": 2,
                "formID": 1,
                "inputType": "text",
                "title": "Extra Informatie",
                "defaultValue": "",
                "required": false,
                "formFieldOptionIDCondition": null,
                "fieldOrder": 1,
                "externalCode": null
            }
        ],
        "selectedFields": [
            {
                "id": 1,
                "ticketID": 1,
                "formFieldID": 1,
                "formFieldValue": 2,
                "createdAt": "2020-01-01 12:00:00",
                "formFieldValueText": null
            }
        ],
        "values": [
            {
                "id": 2,
                "ticketID": 1,
                "formFieldID": 2,
                "formFieldValue": null,
                "createdAt": "2020-05-13 13:29:30",
                "formFieldValueText": "Dit is het text gedeelte"
            }
        ]
    }

Last updated