Project

General

Profile

REST API for Issues + custom fields

Added by Joao C. about 14 years ago

Hi.

I've been playing with REST API as I need to be able to create issues from an external application.
Everything works fine except Custom Fields are being ignored when POST-ing.
HTTP data follows:

Request:

POST /issues.xml HTTP/1.1
Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXX
Host: 192.168.1.100:3000
Accept: */*
Content-Type: text/xml
Length: 215
Content-Length: 215

<?xml version="1.0" encoding="UTF-8"?><issue>
<subject>Issue_from_REST_API</subject>
<project_id>dummy</project_id>
<custom_fields><custom_field name="foo_case_id" id="1">3</custom_field>
</custom_fields>
</issue>

Response:

HTTP/1.1 201 Created
Connection: close
Date: Wed, 10 Mar 2010 15:28:21 GMT
Location: http://192.168.1.100:3000/issues/304
Content-Type: application/xml; charset=utf-8
X-Runtime: 241
Content-Length: 678
Set-Cookie: _redmine_session=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX; path=/; HttpOnly
Cache-Control: no-cache

<?xml version="1.0" encoding="UTF-8"?>
<issue id="304">
  <project name="dummy" id="76"/>
  <tracker name="Proposal" id="4"/>
  <status name="New" id="1"/>
  <priority name="Normal" id="4"/>
  <author name="foo_user" id="35"/>
  <subject>Issue_from_REST_API</subject>
  <description></description>
  <start_date></start_date>
  <due_date></due_date>
  <done_ratio>0</done_ratio>
  <estimated_hours></estimated_hours>
  <spent_hours>0.0</spent_hours>
  <custom_fields>
    <custom_field name="foo_case_id" id="1"></custom_field>
  </custom_fields>
  <created_on>Wed Mar 10 15:28:21 +0000 2010</created_on>
  <updated_on>Wed Mar 10 15:28:21 +0000 2010</updated_on>
</issue>

This is an interesting solution, though, I need Custom Field support to be able to use this API.
I'm using Redmine r3313.

If someone has a solution for this issue, be kind to help. Thanks.

JC


Replies (3)

RE: REST API for Issues + custom fields - Added by Felix Schäfer about 14 years ago

Hi, this seems like you hit a bug, please post a bug report so one of the devs can confirm that this is expected behavior because it's not yet implemented, or if you need to format your POST somewhat else.

RE: REST API for Issues + custom fields - Added by Sergey Rublev almost 14 years ago

How find tickets using ruby API by custom fields ?

Issue.find(:all, :params => {:custom_field_values => {0 => "value"}}) doesn't work.

RE: REST API for Issues + custom fields - Added by Felix Schäfer almost 14 years ago

The interface is a little more complicated because it accommodates even complicated queries. Have a look at your log after having issued a query with custom fields on the web interface and you should be able to find out how it works :-)

    (1-3/3)