Project

General

Profile

Actions

Feature #11159

closed

REST API for getting CustomField definitions

Added by Ruediger Schobbert over 12 years ago. Updated about 11 years ago.

Status:
Closed
Priority:
Normal
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

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

Related to Redmine - Defect #7819: REST API Populating issue field enumerations + Issue list filters New2011-03-09

Actions
Related to Redmine - Feature #9664: CRUD operations for "custom field definitions" (not setting custom fields on issues!)NewEtienne Massip2011-11-25

Actions
Actions

Also available in: Atom PDF