Create a new custom field
POST
/customfieldsCustom Field to add
Example
Section titled “Example”Use resource IDs from your own project. Keep the API token in your server or CI environment.
import { createConfiguration, CustomFieldsApi } from '@testcollab/sdk';
const config = createConfiguration(process.env.TESTCOLLAB_TOKEN!);const api = new CustomFieldsApi(config);
const result = await api.createCustomField({ "customFieldPayload": { "name": "Checkout smoke tests", "entity": "example", "company": 123 }});console.log(result);curl --request POST \ "https://api.testcollab.io/customfields?token=$TESTCOLLAB_TOKEN" \ --header 'Content-Type: application/json' \ --data '{ "id": 123, "name": "example", "entity": "example", "label": "example", "type": "text", "default_value": "example", "is_required": true, "add_to_all_projects": true, "projects": []}'Request body
Section titled “Request body”| Field | Type | Required | Description |
|---|---|---|---|
id |
number | No | — |
name |
string | Yes | — |
entity |
string | Yes | — |
label |
string | No | — |
type |
Custom Field Type | No | — |
default_value |
string | No | NULL if default value not specified, Number type for dropdown field and date, string types for other |
is_required |
boolean | No | — |
add_to_all_projects |
boolean | No | Should link with all projects? |
projects |
Array of number | No | Project IDs in array. Can only be specified if add_to_all_projects is false |
search |
boolean | No | Weather to make this field searchable or not |
extra |
Custom Field Extra Props | No | — |
extra.options |
Array of object | No | This is expected when field type is dropdown |
extra.act_as_config |
boolean | No | Expected when custom field’s entity is TestPlan, In case of true, it will be available under config section while creating a new test plan |
company |
number | Yes | Company ID |
description |
string | No | — |
is_sortable |
boolean | No | — |
Response
Section titled “Response”200 — Created Custom Field
| Field | Type | Required | Description |
|---|---|---|---|
id |
number | Yes | — |
sort_order |
number | No | — |
name |
string | Yes | — |
label |
string | Yes | — |
entity |
string | No | — |
type |
Custom Field Type | Yes | — |
default_value |
string | Yes | NULL if default value not specified, Number type for dropdown field and date, string types for other |
is_required |
boolean | Yes | — |
add_to_all_projects |
boolean | No | Should link with all projects? |
projects |
Array of number | No | Project IDs in array. Can only be specified if add_to_all_projects is false |
search |
boolean | No | Weather to make this field searchable or not |
extra |
Custom Field Extra Props | No | — |
extra.options |
Array of object | No | This is expected when field type is dropdown |
extra.act_as_config |
boolean | No | Expected when custom field’s entity is TestPlan, In case of true, it will be available under config section while creating a new test plan |
company |
number | Yes | Company ID |
description |
string | No | — |
is_sortable |
boolean | No | — |
{ "id": 123, "sort_order": 123, "name": "example", "label": "example", "entity": "example", "type": "text", "default_value": "example", "is_required": true, "add_to_all_projects": true}Errors
Section titled “Errors”| Status | Meaning |
|---|---|
403 |
Forbidden |