UpdateCustomFieldsConfig

This method can be used for the following: Update custom fields configuration for a type;

Parameters

The following URL, Headers and Parameters are required for requests to this API endpoint. Where a parameter is optional, it will be indicated. Otherwise treat all parameters as mandatory.

Headers

PUT /api/ss/config/custom-fields/:type HTTP/1.1
Host: demo.attackforge.com
X-SSAPI-KEY: APIKey
Content-Type: application/json
Connection: close

Query

type (string)

Update configuration options for a particular type. Must be one of the following: project-request, vulnerability-library, asset, or portfolio

Example:

PUT /api/ss/config/custom-fields/project-request HTTP/1.1

config (array of objects)

List of all custom field configuration options for a particular type. This will replace the existing custom field configuration for the specified type.

  • custom_field_type - must be either input, textarea, select, ui-select-multiple, datepicker, or table.

  • custom_field_key - must be a string with alphanumeric & underscores only.

  • custom_field_default_value (optional) - must be a string.

  • custom_field_label - must be a string.

  • custom_field_required - must be either Yes, or No.

  • custom_field_display_in_tables - must be either Yes, or No.

  • custom_field_hide_condition (optional) - must be a string.

  • custom_field_sort_order (optional) - must be a number between 1 and 999.

  • custom_field_placeholder (optional) - must be a string.

  • custom_field_information (optional) - must be a string.

  • custom_field_view_roles (optional) - view access to custom field. must be a string array. Values must be either "admin", "projectoperator", "librarymod", "consultant", "client"

  • custom_field_view_groups (optional) - view access to custom field. must be a string array. Values must be Group Ids.

  • custom_field_view_users (optional) - view access to custom field. must be a string array. Values must be User Ids.

  • custom_field_edit_roles (optional) - edit access to custom field. must be a string array. Values must be either "admin", "projectoperator", "librarymod", "consultant", "client"

  • custom_field_edit_groups (optional) - edit access to custom field. must be a string array. Values must be Group Ids.

  • custom_field_edit_users (optional) - edit access to custom field. must be a string array. Values must be User Ids.

  • custom_field_linked_project_key (optional if type is project-request) - must be a string with alphanumeric & underscores only. type must be set to project-request.

  • custom_field_select_field_options (required if custom_field_type is select or ui-select-multiple) - must be an array of objects. Each object must have an "option" and "value". option must be a string. value must be a string. custom_field_type must be set to either select or ui-select-multiple.

  • custom_field_table_field_columns (required if custom_field_type is table) - must be an array of objects. Each object must have a "column_type", "column_key", "column_label" and "column_required". column_type - must be either input, textarea, select, ui-select-multiple, or datepicker. column_key - must be a string. column_value (optional) - must be a string. column_label - must be a string. column_required - must be either Yes, or No. column_select_field_options - is required if column_type is select or ui-select-multiple. column_select_field_options must be an array of objects. Each object must have an "option" and "value". option must be a string. value must be a string. column_type must be set to either select or ui-select-multiple.

Example:

{
  "config" : [
    {
      "custom_field_type" : "...",
      "custom_field_key" : "...",
      "custom_field_default_value" : "...",
      "custom_field_label" : "...",
      "custom_field_required" : "...",
      "custom_field_display_in_tables" : "...",
      "custom_field_hide_condition" : "...",
      "custom_field_sort_order" : 999,
      "custom_field_placeholder" : "...",
      "custom_field_information" : "...",
      "custom_field_view_roles": [
        "...",
      ],
      "custom_field_view_groups": [
        "...",
      ],
      "custom_field_view_users": [
        "...",
      ],
      "custom_field_edit_roles": [
        "...",
      ],
      "custom_field_edit_groups": [
        "...",
      ],
      "custom_field_edit_users": [
        "...",
      ],
      "custom_field_linked_project_key" : "...",
      "custom_field_select_field_options" : [
        {
          "option": "...",
          "value": "..."
        }
      ],
      "custom_field_table_field_columns" : [
        {
          "column_type" : "...",
          "column_key" : "...",
          "column_value" : "...",
          "column_label" : "...",
          "column_info" : "...",
          "column_required" : "...",
          "column_options" : [
            {
              "option": "...",
              "value": "..."
            }
          ]
        }
      ]
    }
  ]
}

Example

The following example is a cURL request to update custom fields configuration for projects.

Request

Include API Token instead of stars in 'X-SSAPI-KEY: ***************************************' parameter.

curl -X PUT 'https://demo.attackforge.com/api/ss/config/custom-fields/project' -H 'Host: localhost:3000' -H 'X-SSAPI-KEY: ***************************************' -H 'Content-Type: application/json' -H 'Connection: close' -d '{
  "config" : [
    {
      "custom_field_type" : "input",
      "custom_field_key" : "customer_name",
      "custom_field_label" : "Customer Name",
      "custom_field_required" : "Yes",
      "custom_field_display_in_tables" : "No"
    }
  ]
}'

Response

Response contains a status and a list of custom field configuration objects.

{
  "status" : "updated",
  "type" : "...",
  "config" : [
    {
      "custom_field_type" : "...",
      "custom_field_key" : "...",
      "custom_field_default_value" : "...",
      "custom_field_label" : "...",
      "custom_field_required" : "...",
      "custom_field_display_in_tables" : "...",
      "custom_field_hide_condition" : "...",
      "custom_field_sort_order" : 999,
      "custom_field_placeholder" : "...",
      "custom_field_information" : "...",
      "custom_field_linked_project_key" : "...",
      "custom_field_select_field_options" : [
        {
          "option": "...",
          "value": "..."
        }
      ],
      "custom_field_table_field_columns" : [
        {
          "column_type" : "...",
          "column_key" : "...",
          "column_value" : "...",
          "column_label" : "...",
          "column_info" : "...",
          "column_required" : "...",
          "column_options" : [
            {
              "option": "...",
              "value": "..."
            }
          ]
        }
      ]
    }
  ]
}

Last updated

Check YouTube for more tutorials: https://youtube.com/@attackforge