Project

General

Profile

How to obtain invisible custom fields via REST API?

Added by Phillip Buschhüter over 4 years ago

Hi Redmine community,

We use the Redmine Rest API to import time entries in our CRM Software. Now we want to add hourly rates from our freelancers to redmine and import these as well. Therefore we created a user custom field for hourly rate.

Neither the customer nor the user should see or edit the hourly rate. So we made the field invisible and not editable. Unfortunately it is impossible to get the hourly rate from the Rest API as long as the field is invisible.

Is there a work around, to get access to an invisible custom field via API?

Thanks for your support!

Phillip

https://domain.tld/users/48.xml
Custom field is visible:

    <user>
        <id>48</id>
        <login>username</login>
        <firstname>firstname</firstname>
        <lastname>lastname</lastname>
        <mail>email@email.tld</mail>
        <created_on>2018-06-28T15:16:26Z</created_on>
        <last_login_on>2019-07-31T09:49:01Z</last_login_on>
        <api_key>xxx</api_key>
        <status>1</status>
        <custom_fields type="array">
            <custom_field id="2" name="Rate">
                <value>85</value>
            </custom_field>
        </custom_fields>
    </user>

Custom field is invisible:

    <user>
        <id>48</id>
        <login>username</login>
        <firstname>firstname</firstname>
        <lastname>lastname</lastname>
        <mail>email@email.tld</mail>
        <created_on>2018-06-28T15:16:26Z</created_on>
        <last_login_on>2019-07-31T09:49:01Z</last_login_on>
        <api_key>xxx</api_key>
        <status>1</status>
    </user>

System Info:

Environment:
Redmine version 3.4.3.stable
Ruby version 2.3.3-p222 (2016-11-21) [x86_64-linux-gnu]
Rails version 4.2.8
Environment production
Database adapter Mysql2