0

I am trying to create an issue in Redmine (V 2.3.4) via RESTful. I've read the documentation and tried the example which didn't work (HTTP-Code: 404).

POST http://easyredmine.digitronic.com/issues.xml
<?xml version="1.0"?>
<issue>
    <project_id>1</project_id>
    <subject>Example</subject>
    <priority_id>4</priority_id>
</issue>

Then I tried this and it worked:

POST http://easyredmine.digitronic.com/projects/isda/issues.xml
<?xml version="1.0"?>
<issue>
    <project_id>1</project_id>
    <subject>Example</subject>
    <priority_id>4</priority_id>
</issue>

I am using the taskadapter Redmine API which sends requests in the first form.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Simon Ludwig
  • 113
  • 3
  • 9
  • Have you ever enabled the [API-style authentication](http://www.redmine.org/projects/redmine/wiki/Rest_api#Authentication)? – jasonz Mar 31 '14 at 01:24

3 Answers3

0

You get 404 Not Found in the first case because the project (with ID = 1) the issue has to be added to does not exist. In the second case, value in the element project_id is ignored because you already specified project identifier in the URL.

Michal
  • 212
  • 2
  • 10
  • Thank you for Reply. I have executed this request: GET http://easyredmine.digitronic.com/projects.xml and i have received a project with id 39. When I try to make the request with the ID 39 I get the Same error. – Simon Ludwig Mar 31 '14 at 12:15
  • Try GET http://easyredmine.digitronic.com/projects/39/issues.xml if you get 404 or not. Also instead of project numerical ID you can use project string identifier. Finally look at the Redmine log file for any clue. – Michal Mar 31 '14 at 18:56
0

You must specify a content-type header or you will get a 404

0

I use redmine rest api with ruby and the create method works for me.I use json instead of xml.My web service looks like this

id=-1
url = Configuration.redmine+"/issues.json"
uri = URI.parse(url)
req = Net::HTTP::Post.new(uri.request_uri)
req.basic_auth(user, pass)
req["Content-Type"] = "application/json"

payload = {
    issue: {
        project_id:project_id,
        tracker_id:tracker_id,
        status_id:status_id,
        priority_id:priority_id,
        subject:subject,
        description:description,
        fixed_version_id:fixed_version_id,
        author_id:author_id,
    }
}
req.body = payload.to_json

http = Net::HTTP.new(uri.host, uri.port)

response = http.request(req)
if response.code=="201"
  data = JSON.parse(response.body)
  id=data["issue"]["id"]
end

 return id
end

this is ruby code.Hope its help you