Vote #80017
未完了Redmine API updating time entry
0%
説明
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:
Invalid form authenticity token.
journals
I'm not a Ruby/Rails developer, but in routes.rb I can see:
<pre><code class="ruby">
match '/time_entries/:id', :to => 'timelog#destroy', :via => :delete, :id => /\d+/
</code></pre>
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?
--------------------------------------------------------------------------------
It works via .json
For example, this worked for me:
*/time_entries/1.json*
<pre>
{ 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 }
</pre>
--------------------------------------------------------------------------------
XML also works...
/time_entries/1.xml
<pre>
<?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>
</pre>
--------------------------------------------------------------------------------
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
--------------------------------------------------------------------------------