Project

General

Profile

User custom field via REST API

Added by Tibor Racz about 4 years ago

Hi,

Is it possible to POST/PUT user custom field values?

The following syntax generate HTTP status 400 error:

<user><login>mylogin</login><firstname>Firstname</firstname><lastname>lastname</lastname><mail></mail><admin>false</admin><auth_source_id>1</auth_source_id><type>User</type><send_information>true</send_information><status>1</status><custom_fields><custom_fields type="array"><custom_field id="425" name="Site"><value>SiteName</value></custom_field></custom_fields></user>

Error message:

Status: 400
Readystate: 4
Response:
<hash>
<status type="integer">400</status>
<error>Bad Request</error>
</hash>

Thanks in advance!


Replies (3)

RE: User custom field via REST API - Added by Adrián Pradilla Pórtoles about 4 years ago

Hi Tibor:

Be careful because it is not status, it is status_id

Can you try again?
Thanks
Adrián

RE: User custom field via REST API - Added by Tibor Racz about 4 years ago

Dear Adrián,

It does not cause any problem. According to wiki, the status is ok: https://www.redmine.org/projects/redmine/wiki/Rest_Users

If I remove the custom field section, then the API is working well and it creates the user (also with <status>1</status>).

Is it possible that User Custom Fields are not yet managed by the REST API?

Thanks,
Tibor

RE: User custom field via REST API - Added by Tibor Racz about 4 years ago

Tibor Racz wrote:

Hi,

Is it possible to POST/PUT user custom field values?

The following syntax generate HTTP status 400 error:

<user><login>mylogin</login><firstname>Firstname</firstname><lastname>lastname</lastname><mail></mail><admin>false</admin><auth_source_id>1</auth_source_id><type>User</type><send_information>true</send_information><status>1</status><custom_fields><custom_fields type="array"><custom_field id="425" name="Site"><value>SiteName</value></custom_field></custom_fields></user>

Error message:

Status: 400
Readystate: 4
Response:
<hash>
<status type="integer">400</status>
<error>Bad Request</error>
</hash>

Thanks in advance!

    (1-3/3)