Feature #8195
Create an issue with custom fields values
Status: | Closed | Start date: | 2011-04-20 | |
---|---|---|---|---|
Priority: | Normal | Due date: | ||
Assignee: | - | % Done: | 100% | |
Category: | REST API | |||
Target version: | - | |||
Resolution: | Invalid |
Description
I need the custom field tag for a post action
related :
http://www.redmine.org/projects/redmine/wiki/Rest_Issues
History
#1
Updated by Etienne Massip over 11 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>
#2
Updated by Etienne Massip over 11 years ago
- Subject changed from REST API for posting an issue to Create an issue with custom fields values
#3
Updated by Stéphane Schoorens over 11 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
#4
Updated by Etienne Massip over 11 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.
#5
Updated by Stéphane Schoorens over 11 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.
#6
Updated by Stéphane Schoorens over 11 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.
#7
Updated by Stéphane Schoorens over 11 years ago
double post sorry can you remove it ? and how include code with @@?
#8
Updated by Etienne Massip over 11 years ago
Surround your multiline code with
<pre><code class="javascript">...</code>
#9
Updated by Stéphane Schoorens over 11 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.
#10
Updated by Etienne Massip over 11 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',
},
};
?
#11
Updated by Stéphane Schoorens over 11 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.
#12
Updated by Stéphane Schoorens over 11 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.
#13
Updated by Etienne Massip about 11 years ago
- Target version set to Candidate for next major release
#14
Updated by Etienne Massip about 11 years ago
- Target version deleted (
Candidate for next major release)
Could you please try the syntax described in
?#15
Updated by Stéphane Schoorens about 11 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
#16
Updated by Etienne Massip about 11 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 !
#17
Updated by Etienne Massip about 11 years ago
- Status changed from Resolved to Closed
- Resolution set to Invalid
#18
Updated by Stéphane Schoorens about 11 years ago
I've add the field for custom value in the wiki where the posting with json is explain
#19
Updated by Etienne Massip about 11 years ago
Thanks a lot !
#20
Updated by Curtis Weatherford over 4 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.