Custom fields problems
Added by rodrigo reginato over 5 years ago
hi guys, i can't persisted custom fields with API, i'm sending this params:
"subject": title, "description": message,
"project_id": id,
"custom_fields": [
{"id": "1", "value": "0"},
{"id": "2", "value": "20/08/2019"}
])
i tried several times and kinds of differents params.
help me please
Replies (7)
RE: Custom fields problems - Added by Mayama Takeshi over 5 years ago
Checking some code I wrote before I used:
"custom_fields": [{"id": 1, "name": "phone_number", "value": "0312341234"}]
The parameter "name" should be redundant since we are passing "id" but if I decided to add in the code maybe it is because redmine requires it.
RE: Custom fields problems - Added by rodrigo reginato over 5 years ago
Hi thans for your answer, i tried with and without name and i get the sam error.
@remote_errors=#<ActiveResource::ResourceInvalid: Failed. Response code = 422. Response message = Unprocessable Entity .>,
Stéphane Messager={:base=>["tester não pode ficar vazio"]}>
Tester is the name off the custom field, only works if i add a default value, i can't send a new value.
@client.new(:subject => title,
:description => @message,
:project_id => @integration.redmine_project_id,
:custom_fields => [
{id: 4, name: 'tester', value: "teste"}
])
RE: Custom fields problems - Added by Mayama Takeshi over 5 years ago
Hi, I tested now with curl and the name is not necessary (maybe it was needed in a previous version i used).
Custom field defined as:
Format: Text,
Name: phone_number,
No default value
takeshi@takeshi-test:tmp$ curl -s -x '' -H "Content-Type: application/json" -H "X-Redmine-API-Key: REDACTED" http://REDACTED/redmine/issues.json -X POST -d '{"issue": {"subject": "test", "project_id": 1, "description": "test test", "custom_fields": [{"id": 1, "value": "0313241234"}]}}' | jq . { "issue": { "id": 15, "project": { "id": 1, "name": "sales" }, "tracker": { "id": 1, "name": "Bug" }, "status": { "id": 1, "name": "New" }, "priority": { "id": 2, "name": "Normal" }, "author": { "id": 1, "name": "Redmine Admin" }, "subject": "test", "description": "test test", "start_date": "2019-08-22", "done_ratio": 0, "custom_fields": [ { "id": 1, "name": "phone_number", "value": "0313241234" } ], "created_on": "2019-08-21T22:08:14Z", "updated_on": "2019-08-21T22:08:14Z" } }
I'm using redmine commit 6455e0431f04441a8833f100b35f8d9741292185 (Redmine 3.4.2.devel).
If yours doesn't work maybe it is a bug in the version you are using.
RE: Custom fields problems - Added by rodrigo reginato over 5 years ago
My version is 4.0.3,.
I believe it is a bug in this version.
There will be a fix or open an issue on redmine for fix it?
Thanks for your help Mayama.
RE: Custom fields problems - Added by Mayama Takeshi over 5 years ago
I would test on a clean installation of the latest version of Redmine (to be sure it is nothing related to configuration or problems with plugins).
If wrong behavior is confirmed, I would search for it in
https://www.redmine.org/projects/redmine/issues
and report it if necessary.
RE: Custom fields problems - Added by rodrigo reginato over 5 years ago
I thank you so much for your time.. very thanks
RE: Custom fields problems - Added by bokholef fouad about 5 years ago
The parameter "name" should be redundant since we are passing "id" but if I decided to add in the code maybe it is because redmine requires it.