Error 404 when post time_entries

Added by Elmar Kaiser over 10 years ago

Hi everybody,

may you can help me with a problem when posting time_entries? I try to send time_entries to out redmine installation. I've got a programm written in .NET. My data is in an XML format:


- <time_entry>
<project name="Test" id="59" />
<issue id="238" />
<user name="tigaroo" id="5" />
<activity name="Umsetzung" id="9" />
<hours>1.0</hours>
<comments>Testfall</comments>
<spent_on>2012-02-16</spent_on>
</time_entry>

i try to post it to the URL:
http://my.server.de/redmine/time_entries.xml

What i get is an error 404 not found.

I've puzzled the URL from the information in the REST API section here, but it seems to be wrong. Unfortunatly there is no hint in the REST docu or an example how to build the correct URL. So i've tried serval URL's without getting it rigth.

Can somebody my help me with this problem?
(I have seen other members with the same question, but no answer yet)

Thanks tigaroo

Replies (2)

RE: Error 404 when post time_entries - Added by Krystof Vasa over 10 years ago

Hi,

I'm having the same issue and the API documentation for time entries has disappeared from the wiki - http://www.redmine.org/projects/redmine/wiki/Rest_api

What's going on?

Krystof

RE: Error 404 when post time_entries - Added by Andreas Huber about 10 years ago

Hi Elmar

may you can help me with a problem when posting time_entries? I try to send time_entries to out redmine installation. I've got a programm written in .NET. My data is in an XML format:


- <time_entry>
<project name="Test" id="59" />
<issue id="238" />
<user name="tigaroo" id="5" />
<activity name="Umsetzung" id="9" />
<hours>1.0</hours>
<comments>Testfall</comments>
<spent_on>2012-02-16</spent_on>
</time_entry>

i try to post it to the URL:
http://my.server.de/redmine/time_entries.xml

What i get is an error 404 not found.

It appears that I have run into the same issue. The problem is that the xml needs to be formatted differently when you POST compared to what you receive when you make a GET request, as documented here:

<http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries>

That is, your post request would need to have the following body:


<time_entry>
<issue_id>238</issue_id>
<activity_id>9</activity_id>
<hours>1.0</hours>
<comments>Testfall</comments>
<spent_on>2012-02-16</spent_on>
</time_entry>

The user is determined from the credentials you supply with the request, so there's no need to specify it here. Also, by associating the time entry with an issue the project is already known, so no need to specify that either.

Note: I haven't tested the above directly, only the equivalent JSON format.

HTH,

Andreas

(1-2/2)