Defect #31288
openRedmine API updating time entry
0%
Description
Updating a time entry:
http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Updating-a-time-entry
results always in a 404
I'm using Redmine 3.4.6.stable and was using:
PUT /time_entries/[id].xml
Other action like:
Creating a time entry
is working.
Also, Delete is not working and I tried it with JSON as a replacement for XML, but with the same response.
Then I removed the extension like this:
/time_entries/[id]
and I got a 422, but the response gives me a full HTML page with:
<p id="errorExplanation">Invalid form authenticity token.</p>
Updated by Charlie Schaubmair over 5 years ago
I'm not a Ruby/Rails developer, but in routes.rb I can see:
match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
This is the only entry for:
/time_entries/:id
so this means that the documentation at:
http://www.redmine.org/projects/redmine/wiki/Rest_TimeEntries#Updating-a-time-entry
is outdated and there is no end point for updating a time entry.
Is this correct?
Updated by Aleksandar Pavic over 5 years ago
It works via .json
For example, this worked for me:
/time_entries/1.json
{ method: 'PUT', qs: undefined, body: { time_entry: { issue_id: '1', hours: 4, spent_on: '2019-01-01' } }, headers: { 'Content-Type': 'application/json', 'X-Redmine-API-Key': '95228de814b46d8980447c00591460598990d469' }, json: true }
Updated by Aleksandar Pavic over 5 years ago
XML also works...
/time_entries/1.xml
<?xml version="1.0" ?> <time_entry> <id>1</id> <issue_id>1</issue_id> <spent_on>2019-02-02</spent_on> <hours>9.0</hours> </time_entry>
Updated by Charlie Schaubmair over 5 years ago
Aleksandar Pavic visit redminecookbook.com wrote:
It works via .json
For example, this worked for me:
/time_entries/1.json[...]
You've tested it with:
Redmine 3.4.6.stable
?
Because I'm still getting 404 error when posting to e.g:
/time_entries/1.json