Feature #11159
closedREST API for getting CustomField definitions
0%
Description
It would be helpful to have a possibility to query CustomFields for a certain type, since the customfield id and length/regex limitations might be necessary to create a valid REST API POST request.
One workaround to get the id of the customfield is to do a query for the resource first. E.g. for time_entries:
GET /time_entries.xml
will also return the customfields, but only if there is at least one time_entry in the database
If there is no time_entry yet, you can create a dummy one first (also via REST API), and delete that after you got the customfield ids. But this will not work if any of the customfields are mandatory.
This feature is probably related to Feature #9664
I suggest something like:
GET /custom_fields.xml?type=TimeEntryCustomField
which will result in the following response:
<custom_fields type="array"> <custom_field id="1" name="StartTime"> <type>TimeEntryCustomField</type> <format>Text</format> <min_length>5</min_length> <max_length>5</max_length> <regex>[0-2][0-9]:[0-5][0-9]</regex> <default_value></default_value> <required>1</required> </custom_field> <custom_field id="2" name="SomeListField"> <type>TimeEntryCustomField</type> <format>List</format> <multiple>0</multiple> <possible_values> <value>First</value> <value>Second</value> </possible_values> <default_value></default_value> <required>0</required> </custom_field> </custom_fields>
Related issues
Updated by Ruediger Schobbert over 12 years ago
Since this probably takes a while, until it is integrated in redmine, I wrote a little webapp (in groovy, because I only have minimal ruby/redmine knowhow) to serve the customfields.
If anyone is interested they may have a look on github: https://github.com/rschobbert/redmine-customfield-info
Updated by Ruediger Schobbert over 12 years ago
The project redmine-customfield-info on github has been deprecated in favor of the new project redmine-miss-api, which also serves the enumerations. The project can be found on github under: https://github.com/rschobbert/redmine-miss-api
Updated by Jaap de Haan about 11 years ago
+1 too, as filtering is possible on the issues with (nnn being the field id),
GET /issues.xml?cf_nnn=abcdef
there should be at least a way to programmatically figure out what are the fields and which ids they have. (At the moment there is only a dirty workaround by examinating the contents of a ticket, by hoping the wanted fields are present)
My proposal would be to extend the project
query by adding one include
option (beside issue_categories
and trackers
also fields
for example) For a first shot this does not need to be too complicated, having the field names, ids, tpyes and if they are required or not would be already great.
Updated by Toshi MARUYAMA about 11 years ago
- Related to Defect #7819: REST API Populating issue field enumerations + Issue list filters added
Updated by Vincent Caron about 11 years ago
A patch for 'GET /custom_fields.xml' (without the filtering part) is available in #9664.
Updated by Jean-Philippe Lang about 11 years ago
- Related to Feature #9664: CRUD operations for "custom field definitions" (not setting custom fields on issues!) added
Updated by Jean-Philippe Lang about 11 years ago
- Subject changed from REST API - query CustomField Definitions to REST API for getting CustomField definitions
- Status changed from New to Closed
- Assignee set to Jean-Philippe Lang
- Target version set to 2.4.0
- Resolution set to Fixed
Feature added in r12165. The response is slighty different from the proposal, see Rest_CustomFields.
Updated by Alex Last about 11 years ago
what about CRUD for custom field definitions (http://www.redmine.org/issues/9664) ?