Custom Fields
This chapter focuses on custom fields. Custom fields are extra fields that can be attached to certain entities. The set of such extra fields is defined by per-project configuration, which means for instance that two test cases in two distinct projects may have different custom fields.
Please be careful not to be confused with Custom Field Values : whereas a Custom Field is the abstract definition of a field, a Custom Field Value represents an actual value for that field.
TODO : les différents sous-types etc.
Get all custom fields
A GET
to /custom-fields
returns all the custom fields.
HTTP request
GET /api/rest/latest/custom-fields?page=1&size=20 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which attributes of the returned entities should be sorted on (optional) |
|
which fields of the elements should be returned (optional) |
|
which type of the element should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 1344
{
"_embedded" : {
"custom-fields" : [ {
"_type" : "custom-field",
"id" : 1,
"name" : "checkbox1",
"code" : "ck1",
"label" : "ck1",
"optional" : false,
"options" : [ ],
"input_type" : "CHECKBOX",
"default_value" : "true",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/1"
}
}
}, {
"_type" : "custom-field",
"id" : 2,
"name" : "checkbox2",
"code" : "ck2",
"label" : "ck2",
"optional" : false,
"options" : [ ],
"input_type" : "CHECKBOX",
"default_value" : "true",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/2"
}
}
} ]
},
"_links" : {
"first" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields?page=0&size=20"
},
"prev" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields?page=0&size=20"
},
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields?page=1&size=20"
},
"last" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields?page=1&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 22,
"totalPages" : 2,
"number" : 1
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the list of elements for that page |
|
|
the page size for that query |
|
|
total number of elements |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Get custom field
A GET
to /custom-fields/{id}
returns the custom field with the given ID.
Path parameters
Parameter | Description |
---|---|
|
the id of the custom-field |
HTTP request
GET /api/rest/latest/custom-fields/3 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 313
{
"_type" : "custom-field",
"id" : 3,
"name" : "checkbox3",
"code" : "ck3",
"label" : "ck3",
"optional" : false,
"options" : [ ],
"input_type" : "CHECKBOX",
"default_value" : "true",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/3"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the id of the entity |
|
|
the type of the entity |
|
|
name of the custom-field |
|
|
code of the custom-field |
|
|
label of the custom-field |
|
|
the type of custom-field |
|
|
default value of the custom-field |
|
|
if the custom-field is optionnal or not |
|
|
all the options of the custom-field |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this custom-field |
Create custom field
A POST
to /custom-fields
creates a new custom field.
HTTP request
POST /api/rest/latest/custom-fields HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 210
Host: localhost:8080
{
"_type" : "custom-fields",
"name" : "cuf date",
"label" : "label date",
"code" : "code date",
"input_type" : "DATE_PICKER",
"optional" : true,
"default_value" : "2020-04-22",
"options" : [ ]
}
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the type of the custom field :DROPDOWN_LIST,PLAIN_TEXT |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the name of the custom field |
|
|
the default value of the custom field |
|
|
if the custom field is optional or not |
|
|
an array of custom fields |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 333
{
"_type" : "custom-field",
"id" : 4,
"name" : "cuf date",
"code" : "code date",
"label" : "label date",
"optional" : true,
"options" : [ ],
"input_type" : "DATE_PICKER",
"default_value" : "2020-04-22",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/4"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
id of the entity |
|
|
the type of the custom field :DROPDOWN_LIST,PLAIN_TEXT |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the name of the custom field |
|
|
the default value of the custom field |
|
|
if the custom field is optional or not |
|
|
an array of custom fields |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this custom-fields |
Modify custom field
A PATCH
to /custom-fields/{id}
modifies the custom field with the given id.
HTTP request
PATCH /api/rest/latest/custom-fields/5 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 215
Host: localhost:8080
{
"_type" : "custom-fields",
"name" : "cuf text",
"label" : "label text",
"code" : "code text",
"input_type" : "PLAIN_TEXT",
"optional" : true,
"default_value" : "ceci est un test",
"options" : [ ]
}
Path parameters
Parameter | Description |
---|---|
|
the id of the custom field |
Request fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the type of the custom field :DROPDOWN_LIST,PLAIN_TEXT |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the name of the custom field |
|
|
the default value of the custom field |
|
|
if the custom field is optional or not |
|
|
an array of custom fields |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 338
{
"_type" : "custom-field",
"id" : 5,
"name" : "cuf text",
"code" : "code text",
"label" : "label text",
"optional" : true,
"options" : [ ],
"input_type" : "PLAIN_TEXT",
"default_value" : "ceci est un test",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/5"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
id of the entity |
|
|
the type of the custom field :DROPDOWN_LIST,PLAIN_TEXT |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the name of the custom field |
|
|
the default value of the custom field |
|
|
if the custom field is optional or not |
|
|
an array of custom fields |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this custom-fields |
Delete custom field
A DELETE
to /custom-fields/{ids}
deletes the custom field(s) with the given id(s).
HTTP request
DELETE /api/rest/latest/custom-fields/2,3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Path parameters
Parameter | Description |
---|---|
|
a list id of the custom-fields to delete |
HTTP response
HTTP/1.1 204 No Content
Warning
|
Features about custom field options must be modified. |
Add custom field option
A POST
to /custom-fields/{id}/options
adds option to the custom field with the given id .
HTTP request
POST /api/rest/latest/custom-fields/7/options HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 71
Host: localhost:8080
{
"label" : "opt1",
"code" : "code opt 1",
"colour" : "#ff8000"
}
Path parameters
Parameter | Description |
---|---|
|
the id of the custom-field |
Request fields
Path | Type | Description |
---|---|---|
|
|
the label of the custom field option |
|
|
the code of the custom field option |
|
|
the colour of the custom field option |
HTTP response
HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 465
{
"_type" : "custom-field",
"id" : 7,
"name" : "cuf ddl",
"code" : "code ddl",
"label" : "label ddl",
"optional" : true,
"options" : [ {
"label" : "opt1",
"code" : "1",
"colour" : "#ffffff"
}, {
"label" : "opt2",
"code" : "2",
"colour" : "#ff8000"
} ],
"input_type" : "DROPDOWN_LIST",
"default_value" : "",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/7"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
the id of the custom-field |
|
|
the input type of the custom-field |
|
|
the name of the custom-field |
|
|
the code of the custom-field |
|
|
the label of the custom-field |
|
|
the code of the custom-field |
|
|
whe custom-field |
|
|
the custom-field’s options |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this custom-field |
Update custom field option label
A PATCH
to /custom-fields/{id}/options/{optionLabel}/label/{newValue}
modifies the label of the option with given original label .
HTTP request
PATCH /api/rest/latest/custom-fields/6/options/opt/label/opt1 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Path parameters
Parameter | Description |
---|---|
|
the id of the custom-fields |
|
the label of the option to update |
|
the new label of the custom-fields |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 412
{
"_type" : "custom-field",
"id" : 6,
"name" : "cuf text",
"code" : "code text",
"label" : "label text",
"optional" : true,
"options" : [ {
"label" : "opt1",
"code" : "1",
"colour" : "#ffffff"
} ],
"input_type" : "DROPDOWN_LIST",
"default_value" : "ceci est un test",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/rest/latest/custom-fields/6"
}
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the type of the entity |
|
|
id of the entity |
|
|
the type of the custom field :DROPDOWN_LIST,PLAIN_TEXT |
|
|
the label of the custom field |
|
|
the code of the custom field |
|
|
the name of the custom field |
|
|
the default value of the custom field |
|
|
if the custom field is optional or not |
|
|
an array of custom fields |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this custom-fields |