# Custom Fields

Managing ticket form custom fields. Available for administrators only.

# Custom Field Object

Name Type Comment
id integer Unique field identifier.
type string Input field type.
title string Field title/label.
placeholder string Field placeholder.
description string Short description about the field.
required boolean Whether the field is required or not.
meta array Meta-data about the field itself.
created_at datetime Field creation timestamp.
updated_at datetime Field update timestamp.

A type attribute can have the following values:

Field Value
Select Box Input select-box
Standard Text Input text
Textarea Input text-area

# Paginate Fields

GET
/fields

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/fields' \
--header 'Accept: aplication/json'

# Example Response

{
    "data": [
       {
          "id": 4,
          "type": "text",
          "title": "Foo",
          "placeholder": null,
          "description": null,
          "required": false,
          "meta": [],
          "created_at": "2019-09-25 11:54:22",
          "updated_at": "2019-09-25 11:54:22"
        },
      //...
    ],
    "links": {
        //...
    },
    "meta": {
        //...
    }
}

# Available includes

If provided, the available includes will be part of the response for each category object.

categories-count

Number of categories to which a specific field is assigned to.

# Sortable Fields

id (default), title, type

# Partial filters

title

# Exact filters

type

# View a Field

GET
/fields/{id}

# Request

curl --location --request GET 'https://yoursubdomain.support-hub.io/api/fields/4' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

{
    "data": {
      "id": 4,
      "type": "text",
      "title": "Foo",
      "placeholder": null,
      "description": null,
      "required": false,
      "meta": [],
      "created_at": "2019-09-25 11:54:22",
      "updated_at": "2019-09-25 11:54:22"
    }
}

# Available includes

Same as when paginating the fields.

# Create a Field

POST
/fields

# Parameters

Parameter Type Required Validation
title string Yes Any string with length shorter or equal to 100 characters.
type string Yes One of the following values: text, text-area, select-box.
options array Only if type is select-box Array of string values.
required boolean No Whether a field should be required or not.
description string No Any string with length shorter or equal to 250 characters.
placeholder string No Any string with length shorter or equal to 100 characters.

# Request

curl --location --request POST 'https://yoursubdomain.support-hub.io/api/fields' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "Foo",
  "type": "text"
}'

# Example Response

Status: 201 Created

{
    "data": {
      "id": 4,
      "type": "text",
      "title": "Foo",
      "placeholder": null,
      "description": null,
      "required": false,
      "meta": [],
      "created_at": "2019-09-25 11:54:22",
      "updated_at": "2019-09-25 11:54:22"
    }
}

# Update a Field

PATCH
/fields/{id}

# Parameters

Parameter Type Required Validation
title string No Any string with length shorter or equal to 100 characters.
type string No One of the following values: text, text-area, select-box.
options array Only if type is select-box Array of string values.
required boolean No Whether a field should be required or not.
description string No Any string with length shorter or equal to 250 characters.
placeholder string No Any string with length shorter or equal to 100 characters.

# Request

curl --location --request PATCH 'https://yoursubdomain.support-hub.io/api/fields/4' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
  "title": "Foo - Updated"
}'

# Example Response

Status: 200 OK

{
    "data": {
      "id": 4,
      "type": "text",
      "title": "Foo - Updated",
      "placeholder": null,
      "description": null,
      "required": false,
      "meta": [],
      "created_at": "2019-09-25 11:54:22",
      "updated_at": "2019-09-25 11:54:22"
    }
}

# Delete a Field

DELETE
/fields/{id}

# Request

curl --location --request DELETE 'https://yoursubdomain.support-hub.io/api/fields/4' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'

# Example Response

Status: 200 OK

{
    "success": true
}