Field metadata reference
Field metadata describes the fields available for an entity. Each field has properties and features, such as the type of the field, whether the field’s values are audited, and validations on the field.
In this topic:
- URI
- Filter field metadata using the URI
- Supported HTTP Methods
- Properties
- Field types
- Data validation
- Example: Metadata for a run field object
URI
The table below lists the URIs for the different levels.
For the syntax for specifying parameters in URIs, see Variables and values.
Throughout this document, the example URIs are abbreviated, without the server and port context.
http://<server>:<port>/api/shared_spaces/<space_id>/workspaces/<workspace_id>/<entities>
Becomes:
.../api/shared_spaces/<space_id>/workspaces/<workspace_id>/<entities>
Filter field metadata using the URI
You can filter on all attributes when filtering field metadata.
When filtering metadata, unlike regular filtering on entities:
- Only the query clause is supported. You cannot use the limit, offset, total_count, or order_by clauses.
- The Or operator (||) is not supported between query phases in the query statement. Only the And operator (;) is supported.
- The entity_name sets the context for any other query phrases in the query statement.
Examples
-
To list fields only related to defects:
http[s]://<server>:<port>/api/shared_spaces/<space_id>/workspaces/<workspace_id>/metadata/fields?query="entity_name EQ 'defect'"
-
To list the required fields for manual tests:
http://<server>:<port>/api/shared_spaces/<space_id>/workspaces/<workspace_id>/metadata/fields?query="entity_name EQ 'test_manual' ; required EQ true"
-
To list defect fields that have a creation_time property:
http[s]://<server>:<port>/api/shared_spaces/<space_id>/workspaces/<workspace_id>/metadata/fields?query="entity_name EQ 'defect'; "name EQ 'creation_time'"
-
To list only user-defined fields, query the field metadata with the is_user_defined attribute:
http[s]://<server>:<port>/api/shared_spaces/<space_id>/workspaces/<workspace_id>/metadata/fields?query="is_user_defined EQ true"
Supported HTTP Methods
This API supports only the GET operation.
Properties
Below are the properties that describe each field in the REST API.
Note: Each relation is represented as a reference field for both of the entities that are involved in the relation.
Field | Properties |
---|---|
Access level |
If the field can be accessed (such as PUBLIC, or PUBLIC_TECH_PREVIEW).
|
Accessible by rules |
Whether rules can access this field.
|
Auto-generated |
Whether the field is generated automatically.
|
Description |
The description for the field.
|
Entity name |
The entity the field belongs to.
|
Features |
Set of the features supported for this field, such as: |
Field type |
The type of the field’s expected value.
For the available field types, see Field types. |
Filterable |
Whether the field can be filtered .
|
Groupable |
Whether you can group by this field.
|
Label |
The label of the field as might appear in UI.
|
Name |
The name of the field as it appears in API representation.
|
Returned by default |
Whether the field is returned by default when there is no field selection.
Note: Default fields are not returned for TECH-PREVIEW resources. |
Selectable |
Whether the field can be used in a query. Some fields are intentionally not selectable, if they would return too many results. For example, you can query a defect by its severity. But querying a severity and all associated defects would potentially return too many results.
|
Sortable |
Whether we can sort entities according to this field.
|
Supports permissions |
Whether the field is controlled by permissions.
|
User-defined |
Whether the field is system-defined or user-defined.
|
Visible |
Whether the field is visible in the user interface.
|
Field types
The following table describes the field types available for an entity.
Data validation
Data validation lets you validate inputs and outputs.
This provides a way for the consumer to validate inputs before inputs are sent to the server, and to expect certain outputs to be returned from the server.
You can validate both inputs and outputs.
Note: Some validations depend on the context. In these cases, a status code and an error message are returned.
Input
Values sent to the server can be validated.
Some validations are optional.
Some validations are allowed for specific data types only.
Input validation |
Integer |
Boolean |
Date / DateTime |
String |
Memo |
Reference |
---|---|---|---|---|---|---|
Final |
|
![]() |
![]() |
![]() |
![]() |
![]() |
Maximum Length |
|
|
|
Mandatory |
|
|
Maximum Value | Mandatory |
![]() |
![]() |
![]() |
![]() |
![]() |
Minimum Value | Mandatory |
![]() |
![]() |
![]() |
![]() |
![]() |
Not Null |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Read Only |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Unique |
|
|
|
![]() |
|
|
Data type | Description | Field name | Value | Example |
---|---|---|---|---|
Editable | Determines whether a field is read-only. | editable | Boolean | "editable": true
|
Final | A value can be supplied to a field only upon creation of an entity. Then the field becomes read-only. This means that subsequent attempts to PUT a value in the field results in a 400 (Bad Request) error. | final | Boolean | “final”: true
|
Maximum Length | Enforces a maximum length of a string field. | max_length | Integer, >0 | “max_length”: 70
|
Maximum Value | Enforces a maximum value for integer fields. | max_value | Integer. Must be greater than or equal to the minimum value validation. | "max_value": 10000
|
Minimum Value | Enforces a minimum value for integer fields. | min_value | Integer. Must be less than or equal to the maximum value validation. | "min_value": 1
|
Not Null | Determines whether a null value is allowed. | required | Boolean | “required”: true
|
Read Only | Determines whether the field is read only. . This means that attempts to PUT a value in the field results in a 400 (Bad Request) error. | editable | Boolean | “editable”: true
|
Unique | Enforces uniqueness on the level of the whole entity type. | unique | Boolean | “unique”: true
|
Output
Values that are being returned from the server can be validated.
Validations are optional.
Some validations are allowed from specific data types only.
Output validation |
Integer / Long |
Boolean |
Date / DateTime |
String |
Memo |
Reference |
---|---|---|---|---|---|---|
Sanitization |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Data type | Description | Field name | Value | Example |
---|---|---|---|---|
Enforces sanitization for the field’s output and provides options for types of sanitization. See also: Sanitization. |
sanitization |
A string value that represents an enum: {text, html} |
|
Example: Metadata for a run field object
{
"name": "description",
"entity_name": "run",
"filterable": false,
"editable": true,
"returned_by_default": true,
"label": "Description",
"sortable": false,
"required": false,
"sanitization": "HTML",
"unique": false,
"field_type": "memo",
"max_length": null
}
See also: