プロジェクト

全般

プロフィール

Vote #80017

未完了

Redmine API updating time entry

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
New
優先度:
通常
担当者:
-
カテゴリ:
REST API_32
対象バージョン:
-
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
32
version_id:
0
issue_org_id:
31288
author_id:
398753
assigned_to_id:
0
comments:
4
status_id:
1
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
141
ステータス-->[New]

説明

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

--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリREST API_32 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0