Defect #11443
closedPOST /time_entries.xml lead to 404 error
0%
Description
I have create an "a.xml" with :
<time_entry> <issue_id>3</issue_id> <hours>1.0</hours> </time_entry>
The issue id 3 is the issue I want to add time with REST API
Here my request :
curl -v -H 'X-Redmine-API-Key: MYAPIKEY' -X POST -d '@a.xml' http://MYSERVER/time_entries.xml
The result is :
* About to connect() to MYSERVER port 80 (#0) * Trying 88.190.234.245... connected * Connected to MYSERVER (MYIPSERVER) port 80 (#0) > POST /time_entries.xml HTTP/1.1 > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5 > Host: MYSERVER > Accept: */* > X-Redmine-API-Key: MYAPIKEY > Content-Length: 178 > Content-Type: application/x-www-form-urlencoded > < HTTP/1.1 404 Not Found < Content-Type: application/xml; charset=utf-8 < Transfer-Encoding: chunked < Connection: keep-alive < Status: 404 < X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.13 < X-UA-Compatible: IE=Edge,chrome=1 < Cache-Control: no-cache < Set-Cookie: _redmine_session=MYSESSION; path=/; HttpOnly < Set-Cookie: autologin=; path=/; expires=Thu, 01-Jan-1970 00:00:00 GMT < X-Request-Id: 8b3793562127ef727ffe79ebb431fd3b < X-Runtime: 0.007519 < Date: Thu, 19 Jul 2012 00:30:20 GMT < X-Rack-Cache: invalidate, pass < Server: nginx/1.2.1 + Phusion Passenger 3.0.13 (mod_rails/mod_rack) < * Connection #0 to host MYSERVER left intact * Closing connection #0
I use Redmine tags 2.0.3, on nginx 1.2.1 with passenger 3.0.13 with ruby 1.9.3p194 and rails 3.2.6.
The REST API is activated and I use my REST API to communicate.
I want to create a perl module that can communicate with Redmine API but first I need to understand how to communicate. The API doc is not quite obvious on the subject.
Could you tell me what I doing wrong ?
Updated by Jean-Philippe Lang almost 11 years ago
You have to set the Content-Type
header of your request to application/xml
.
Updated by celogeek san almost 11 years ago
Great ! It work. But on the opposite of the REST Api Spec, we need to indicate an activity !
With it, this work.
It also work in json mode.
I will start a Perl app that can connect and do all stuff about Redmine.
Updated by Jean-Philippe Lang almost 11 years ago
- Status changed from Resolved to Closed
- Resolution set to Invalid
celogeek san wrote:
Great ! It work. But on the opposite of the REST Api Spec, we need to indicate an activity !
The doc is OK:
activity_id
: the id of the time activity. This parameter is required unless a default activity is defined in Redmine.
Anyway, thanks for the feedback.
Updated by celogeek san almost 11 years ago
Yeah, but an API on that could be great to create apps that chat with Redmine API.
I think on git hooks, browser extension, command line tools ...
I have write this : https://metacpan.org/module/Redmine::API
I will use it in App::Redmine and plug it to git hooks after.