Feature #8195
closedCreate an issue with custom fields values
100%
Description
I need the custom field tag for a post action
related :
http://www.redmine.org/projects/redmine/wiki/Rest_Issues
Updated by Etienne Massip over 13 years ago
I think that it can be done ; did you try with
?<?xml version="1.0"?> <issue> <subject>Example</subject> <project_id>1</project_id> <priority_id>4</priority_id> ... <custom_values> <custom_value> <custom_field_id>2</custom_field_id> <value>Hello world !</value> </custom_value> </custom_values> ... </issue>
Updated by Etienne Massip over 13 years ago
- Subject changed from REST API for posting an issue to Create an issue with custom fields values
Updated by Stéphane Schoorens over 13 years ago
I use my REST API for transform name into id
I use this type of data :
my $valeurs = {
issue => {
tracker => 'Anomalie',
status => 'In Progress',
priority => 'Urgent',
subject => 'new',
description => 'helloworld,
category => 'Module',
project => 'test',
custom_values => {
custom_value => {
custom_field_id => 3,
value[or name] => '123',
},
},
},
};
i'm using a json encoded and i post it after
and custom values doesn't work .
my api: https://github.com/sschoorens/Net--Redmine--API--REST
not yet on cpan i'm in dev
Updated by Etienne Massip over 13 years ago
custom_field_values
is a safe attribute of Issue
which requires the issue id as it's used for a many-to-many relationship and this case may not be handled by code in IssueController#build_from_params@ (source:trunk/app/controllers/issues_controller.rb#L311).
Maybe a subsequent /edit POST
request to add the custom values with new issue's id specified could do the job, not sure though.
Updated by Stéphane Schoorens over 13 years ago
I've tried to make a PUT request on a issue with that values :
my $refhash = {
issue => {
custom_values => {
custom_value => {
custom_field_id => 12,
value => 'france',
},
},
notes => 'put custom',
},
};
but just the notes was added.
Updated by Stéphane Schoorens over 13 years ago
I've tried to make a PUT request on a issue with that values :
@my $refhash = {
@ issue => {@ custom_values => {
@ custom_value => {@ custom_field_id => 12,
@ value => 'france',@ },
@ },@ notes => 'put custom',
@ },
@@ };
but just the notes was added.
Updated by Stéphane Schoorens over 13 years ago
double post sorry can you remove it ? and how include code with @@?
Updated by Etienne Massip over 13 years ago
Surround your multiline code with
<pre><code class="javascript">...</code>
Updated by Stéphane Schoorens over 13 years ago
I've tried to make a PUT request on a issue with that values :
my $refhash = { issue => { custom_values => { custom_value => { custom_field_id => 12, value => 'france', }, }, notes => 'put custom', }, };
but just the notes was added.
Updated by Etienne Massip over 13 years ago
Could you try to edit issue with PUT /issues/[issue_id].json
of
{
issue => {
custom_values => {
custom_value => {
customized_type => 'issue',
customized_id => [issue_id],
custom_field => 'my custom field',
value => 'france',
},
},
notes => 'put custom',
},
};
?
Updated by Stéphane Schoorens over 13 years ago
I've tried this on a custom field who's name 'Origine' :
{
issue => {
custom_values => {
custom_value => {
customized_type => 'issue',
customized_id => '424',
custom_field => 'Origine',
value => 'france',
},
},
notes => 'put custom',
},
};
Only the notes is put.
Updated by Stéphane Schoorens over 13 years ago
This is the return of json encode of an issue :
"custom_fields":[{"value":"","name":"Resolution","id":2}]
so I've tested the same like this :
{
issue => {
custom_fields =>[ {
id => '12',
value => '',
name => 'france',
} ],
notes => 'put custom',
},
};
but already only the notes are update.
Updated by Etienne Massip over 13 years ago
- Target version set to Candidate for next major release
Updated by Etienne Massip over 13 years ago
- Target version deleted (
Candidate for next major release)
Could you please try the syntax described in
?Updated by Stéphane Schoorens over 13 years ago
- Status changed from New to Resolved
- % Done changed from 0 to 100
It works =p ! thanks you it works also with a POST
Updated by Etienne Massip over 13 years ago
If you have a few time, could you please add some doc about this in REST issues wiki page, that would be very nice ?
Or simply copy a full working example here so I could update wiki page myself.
Thanks !
Updated by Etienne Massip over 13 years ago
- Status changed from Resolved to Closed
- Resolution set to Invalid
Updated by Stéphane Schoorens over 13 years ago
I've add the field for custom value in the wiki where the posting with json is explain
Updated by Curtis Weatherford almost 7 years ago
Stéphane Schoorens wrote:
I've add the field for custom value in the wiki where the posting with json is explain
Could you please add a link to this because I can't seem to find it.