Project

General

Profile

Actions

Feature #11159

closed

REST API for getting CustomField definitions

Added by Ruediger Schobbert almost 12 years ago. Updated over 10 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 #1

Updated by Ruediger Schobbert over 11 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

Actions #2

Updated by Ruediger Schobbert over 11 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

Actions #3

Updated by Stéphane Klein almost 11 years ago

+1

Actions #4

Updated by Jaap de Haan over 10 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.

Actions #5

Updated by Toshi MARUYAMA over 10 years ago

  • Related to Defect #7819: REST API Populating issue field enumerations + Issue list filters added
Actions #6

Updated by Vincent Caron over 10 years ago

A patch for 'GET /custom_fields.xml' (without the filtering part) is available in #9664.

Actions #7

Updated by Jean-Philippe Lang over 10 years ago

  • Related to Feature #9664: CRUD operations for "custom field definitions" (not setting custom fields on issues!) added
Actions #8

Updated by Jean-Philippe Lang over 10 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.

Actions #9

Updated by Alex Last over 10 years ago

what about CRUD for custom field definitions (http://www.redmine.org/issues/9664) ?

Actions

Also available in: Atom PDF