Defect #9370

Modifying time_entry gives 403 forbidden

Added by Pasi Oja-Nisula about 11 years ago. Updated over 10 years ago.

Status:ClosedStart date:2011-10-04
Priority:NormalDue date:
Assignee:-% Done:


Category:REST API
Target version:-
Resolution:Invalid Affected version:1.2.0


I'm trying to modify a time entry. Here's the test program.

from pyactiveresource.activeresource import ActiveResource

class TimeEntry(ActiveResource):
    _site = ''
    _user = 'myusername'
    _password = 'mypassword'
    _request_format = 'xml'

time_entries = TimeEntry.find()
print time_entries
entry = time_entries[0]
print entry.comments
entry.comments = "tesmi2"

Redmine log shows this:

Processing TimelogController#index to xml (for at 2011-10-04 10:23:14) [GET]
Parameters: {"format"=>"xml", "action"=>"index", "controller"=>"timelog"}
Rendering timelog/index
Completed in 30ms (View: 2, DB: 9) | 200 OK []

Processing TimelogController#update to xml (for at 2011-10-04 10:23:15) [PUT]
Parameters: {"time_entry"=>{"comments"=>"tesmi2", "created_on"=>"2011-10-04T09:32:46+03:00", "activity"=>{"name"=>"Development", "id"=>"9"}, "id"=>"28", "project"=>{"name"=>"Test", "id"=>"7"}, "updated_on"=>"2011-10-04T09:32:46+03:00", "spent_on"=>"2011-10-04", "issue"=>{"id"=>"5047"}, "hours"=>"1.0", "user"=>{"name"=>"Pasi Oja-Nisula", "id"=>"4"}}, "format"=>"xml", "action"=>"update", "id"=>"28", "controller"=>"timelog"}
Filter chain halted as [:find_time_entry] rendered_or_redirected.
Completed in 16ms (View: 0, DB: 4) | 403 Forbidden []



#1 Updated by Etienne Massip about 11 years ago

Are you sure that your user is allowed to see the time entry when going through application screens?

#2 Updated by Pasi Oja-Nisula about 11 years ago

  • Status changed from New to Resolved

You have good eye for newbie errors. I was trying to do too many things which I don't understand. When I skipped the activeresource part and tried with curl, I got this to work. Here's the working example.

echo '<time-entry><issue_id>5047</issue_id><hours>1.5</hours><activity_id>9</activity_id><comments>tesmi6</comments></time-entry>' | curl k -u myusername:mypassword -X PUT -H 'Content-type: text/xml' -H 'Accept: text/xml' -d @


#3 Updated by Etienne Massip about 11 years ago

  • Status changed from Resolved to Closed
  • Resolution set to Invalid

#4 Updated by Raynard Rodman about 11 years ago


Also available in: Atom PDF