Project

General

Profile

REST API issues.xml with assigned_to

Added by Dmit nitkin almost 14 years ago

Hi
when I request issues.xml?assigned_to=me I get all issues not only mine. Is this a bug or smth wrong in my uri?
here is the log from development (redmine 1.0.2, but redmine 1.0.4 seems to be the same). Looks like there is an error in this query "4;35;1mIssue Load Including Associations (0.0ms)[0m [0mSELECT "issues"."id" ...."

Processing IssuesController#index to xml (for 127.0.0.1 at 2010-12-07 11:09:55) [GET]
  Parameters: {"format"=>"xml", "assigned_to"=>"me", "action"=>"index", "controller"=>"issues"}
  [4;35;1mSQL (0.0ms)[0m   [0mSELECT max("settings".updated_on) AS max_updated_on FROM "settings" [0m
  [4;36;1mSetting Load (0.0ms)[0m   [0;1mSELECT * FROM "settings" WHERE ("settings"."name" = 'rest_api_enabled') LIMIT 1[0m
  [4;35;1mUser Load (0.0ms)[0m   [0mSELECT * FROM "users" WHERE ( login = 'user0') AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) LIMIT 1[0m
  [4;36;1mUser Update (0.0ms)[0m   [0;1mUPDATE "users" SET "last_login_on" = '2010-12-07 11:09:55', "updated_on" = '2010-12-07 11:09:55' WHERE "id" = 3[0m
  [4;35;1mCustomField Load (0.0ms)[0m   [0mSELECT * FROM "custom_fields" WHERE (type = 'UserCustomField') ORDER BY position[0m
  [4;36;1mMember Load Including Associations (0.0ms)[0m   [0;1mSELECT "members"."id" AS t0_r0, "members"."user_id" AS t0_r1, "members"."project_id" AS t0_r2, "members"."created_on" AS t0_r3, "members"."mail_notification" AS t0_r4, "projects"."id" AS t1_r0, "projects"."name" AS t1_r1, "projects"."description" AS t1_r2, "projects"."homepage" AS t1_r3, "projects"."is_public" AS t1_r4, "projects"."parent_id" AS t1_r5, "projects"."created_on" AS t1_r6, "projects"."updated_on" AS t1_r7, "projects"."identifier" AS t1_r8, "projects"."status" AS t1_r9, "projects"."lft" AS t1_r10, "projects"."rgt" AS t1_r11, "roles"."id" AS t2_r0, "roles"."name" AS t2_r1, "roles"."position" AS t2_r2, "roles"."assignable" AS t2_r3, "roles"."builtin" AS t2_r4, "roles"."permissions" AS t2_r5 FROM "members" LEFT OUTER JOIN "projects" ON "projects".id = "members".project_id LEFT OUTER JOIN "member_roles" ON ("members"."id" = "member_roles"."member_id") LEFT OUTER JOIN "roles" ON ("roles"."id" = "member_roles"."role_id") WHERE ("members".user_id = 3 AND (projects.status=1)) ORDER BY projects.name[0m
  [4;35;1mTracker Load (0.0ms)[0m   [0mSELECT * FROM "trackers" ORDER BY position[0m
  [4;36;1mIssueStatus Load (0.0ms)[0m   [0;1mSELECT * FROM "issue_statuses" ORDER BY position[0m
  [4;35;1mIssuePriority Load (0.0ms)[0m   [0mSELECT * FROM "enumerations" WHERE ( ("enumerations"."type" = 'IssuePriority' ) ) ORDER BY enumerations.position ASC[0m
  [4;36;1mProject Load (0.0ms)[0m   [0;1mSELECT * FROM "projects" WHERE (projects.status=1 AND (projects.is_public = 't' or projects.id IN (1,2))) [0m
  [4;35;1mUser Load (10.0ms)[0m   [0mSELECT * FROM "users" WHERE (users.id IN (SELECT DISTINCT user_id FROM members WHERE project_id IN (1,2))) AND (users.status = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) [0m
  [4;36;1mSetting Load (0.0ms)[0m   [0;1mSELECT * FROM "settings" WHERE ("settings"."name" = 'user_format') LIMIT 1[0m
  [4;35;1mRole Load (0.0ms)[0m   [0mSELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1[0m
  [4;36;1mVersion Load Including Associations (0.0ms)[0m   [0;1mSELECT "versions"."id" AS t0_r0, "versions"."project_id" AS t0_r1, "versions"."name" AS t0_r2, "versions"."description" AS t0_r3, "versions"."effective_date" AS t0_r4, "versions"."created_on" AS t0_r5, "versions"."updated_on" AS t0_r6, "versions"."wiki_page_title" AS t0_r7, "versions"."status" AS t0_r8, "versions"."sharing" AS t0_r9, "projects"."id" AS t1_r0, "projects"."name" AS t1_r1, "projects"."description" AS t1_r2, "projects"."homepage" AS t1_r3, "projects"."is_public" AS t1_r4, "projects"."parent_id" AS t1_r5, "projects"."created_on" AS t1_r6, "projects"."updated_on" AS t1_r7, "projects"."identifier" AS t1_r8, "projects"."status" AS t1_r9, "projects"."lft" AS t1_r10, "projects"."rgt" AS t1_r11 FROM "versions" LEFT OUTER JOIN "projects" ON "projects".id = "versions".project_id WHERE ("versions"."sharing" = 'system') AND (((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (1=0 OR projects.id IN (2)))) [0m
  [4;35;1mIssueCustomField Load (0.0ms)[0m   [0mSELECT * FROM "custom_fields" WHERE ("custom_fields"."is_filter" = 't' AND "custom_fields"."is_for_all" = 't') AND ( ("custom_fields"."type" = 'IssueCustomField' ) ) [0m
  [4;36;1mProject Load (0.0ms)[0m   [0;1mSELECT * FROM "projects" WHERE (projects.status=1 AND (projects.is_public = 't' or projects.id IN (1,2))) ORDER BY lft[0m
  [4;35;1mIssueCustomField Load (0.0ms)[0m   [0mSELECT * FROM "custom_fields" WHERE ( ("custom_fields"."type" = 'IssueCustomField' ) ) [0m
  [4;36;1mSetting Load (0.0ms)[0m   [0;1mSELECT * FROM "settings" WHERE ("settings"."name" = 'per_page_options') LIMIT 1[0m
  [4;35;1mCACHE (0.0ms)[0m   [0mSELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1[0m
  [4;36;1mCACHE (0.0ms)[0m   [0;1mSELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1[0m
  [4;35;1mSQL (0.0ms)[0m   [0mselect sqlite_version(*)[0m
  [4;36;1mSQL (0.0ms)[0m   [0;1mSELECT count(DISTINCT "issues".id) AS count_all FROM "issues" LEFT OUTER JOIN "issue_statuses" ON "issue_statuses".id = "issues".status_id LEFT OUTER JOIN "projects" ON "projects".id = "issues".project_id WHERE ((issue_statuses.is_closed='f') AND (((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (1=0 OR projects.id IN (2))) OR ((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (1=0 OR projects.id IN (1,2))) AND (issues.author_id=3 OR issues.assigned_to_id=3 OR issues.id IN (SELECT watchers.watchable_id FROM watchers WHERE watchers.watchable_type='Issue' AND user_id=3)) OR issues.author_id in (SELECT user_id from groups_users where group_id in (SELECT group_id from groups_users where user_id=3 ))) ) [0m
  [4;35;1mCACHE (0.0ms)[0m   [0mSELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1[0m
  [4;36;1mCACHE (0.0ms)[0m   [0;1mSELECT * FROM "roles" WHERE ("roles"."builtin" = 1) LIMIT 1[0m
  [4;35;1mIssue Load Including Associations (0.0ms)[0m   [0mSELECT "issues"."id" AS t0_r0, "issues"."tracker_id" AS t0_r1, "issues"."project_id" AS t0_r2, "issues"."subject" AS t0_r3, "issues"."description" AS t0_r4, "issues"."due_date" AS t0_r5, "issues"."category_id" AS t0_r6, "issues"."status_id" AS t0_r7, "issues"."assigned_to_id" AS t0_r8, "issues"."priority_id" AS t0_r9, "issues"."fixed_version_id" AS t0_r10, "issues"."author_id" AS t0_r11, "issues"."lock_version" AS t0_r12, "issues"."created_on" AS t0_r13, "issues"."updated_on" AS t0_r14, "issues"."start_date" AS t0_r15, "issues"."done_ratio" AS t0_r16, "issues"."estimated_hours" AS t0_r17, "issues"."parent_id" AS t0_r18, "issues"."root_id" AS t0_r19, "issues"."lft" AS t0_r20, "issues"."rgt" AS t0_r21, "issue_statuses"."id" AS t1_r0, "issue_statuses"."name" AS t1_r1, "issue_statuses"."is_closed" AS t1_r2, "issue_statuses"."is_default" AS t1_r3, "issue_statuses"."position" AS t1_r4, "issue_statuses"."default_done_ratio" AS t1_r5, "projects"."id" AS t2_r0, "projects"."name" AS t2_r1, "projects"."description" AS t2_r2, "projects"."homepage" AS t2_r3, "projects"."is_public" AS t2_r4, "projects"."parent_id" AS t2_r5, "projects"."created_on" AS t2_r6, "projects"."updated_on" AS t2_r7, "projects"."identifier" AS t2_r8, "projects"."status" AS t2_r9, "projects"."lft" AS t2_r10, "projects"."rgt" AS t2_r11, "users"."id" AS t3_r0, "users"."login" AS t3_r1, "users"."hashed_password" AS t3_r2, "users"."firstname" AS t3_r3, "users"."lastname" AS t3_r4, "users"."mail" AS t3_r5, "users"."mail_notification" AS t3_r6, "users"."admin" AS t3_r7, "users"."status" AS t3_r8, "users"."last_login_on" AS t3_r9, "users"."language" AS t3_r10, "users"."auth_source_id" AS t3_r11, "users"."created_on" AS t3_r12, "users"."updated_on" AS t3_r13, "users"."type" AS t3_r14, "users"."identity_url" AS t3_r15, "trackers"."id" AS t4_r0, "trackers"."name" AS t4_r1, "trackers"."is_in_chlog" AS t4_r2, "trackers"."position" AS t4_r3, "trackers"."is_in_roadmap" AS t4_r4, "enumerations"."id" AS t5_r0, "enumerations"."name" AS t5_r1, "enumerations"."position" AS t5_r2, "enumerations"."is_default" AS t5_r3, "enumerations"."type" AS t5_r4, "enumerations"."active" AS t5_r5, "enumerations"."project_id" AS t5_r6, "enumerations"."parent_id" AS t5_r7, "issue_categories"."id" AS t6_r0, "issue_categories"."project_id" AS t6_r1, "issue_categories"."name" AS t6_r2, "issue_categories"."assigned_to_id" AS t6_r3, "versions"."id" AS t7_r0, "versions"."project_id" AS t7_r1, "versions"."name" AS t7_r2, "versions"."description" AS t7_r3, "versions"."effective_date" AS t7_r4, "versions"."created_on" AS t7_r5, "versions"."updated_on" AS t7_r6, "versions"."wiki_page_title" AS t7_r7, "versions"."status" AS t7_r8, "versions"."sharing" AS t7_r9 FROM "issues" LEFT OUTER JOIN "issue_statuses" ON "issue_statuses".id = "issues".status_id LEFT OUTER JOIN "projects" ON "projects".id = "issues".project_id LEFT OUTER JOIN "users" ON "users".id = "issues".assigned_to_id AND ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) LEFT OUTER JOIN "trackers" ON "trackers".id = "issues".tracker_id LEFT OUTER JOIN "enumerations" ON "enumerations".id = "issues".priority_id AND ("enumerations"."type" = 'IssuePriority' ) LEFT OUTER JOIN "issue_categories" ON "issue_categories".id = "issues".category_id LEFT OUTER JOIN "versions" ON "versions".id = "issues".fixed_version_id WHERE (((issue_statuses.is_closed='f') AND (((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (1=0 OR projects.id IN (2))) OR ((projects.status=1 AND projects.id IN (SELECT em.project_id FROM enabled_modules em WHERE em.name='issue_tracking')) AND (1=0 OR projects.id IN (1,2))) AND (issues.author_id=3 OR issues.assigned_to_id=3 OR issues.id IN (SELECT watchers.watchable_id FROM watchers WHERE watchers.watchable_type='Issue' AND user_id=3)) OR issues.author_id in (SELECT user_id from groups_users where group_id in (SELECT group_id from groups_users where user_id=3 ))) )) ORDER BY issues.id DESC LIMIT 25 OFFSET 0[0m
Rendering issues/index
  [4;36;1mUser Load (0.0ms)[0m   [0;1mSELECT * FROM "users" WHERE ("users"."id" = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) [0m
  [4;35;1mSetting Load (0.0ms)[0m   [0mSELECT * FROM "settings" WHERE ("settings"."name" = 'issue_done_ratio') LIMIT 1[0m
  [4;36;1mIssueCustomField Load (0.0ms)[0m   [0;1mSELECT * FROM "custom_fields" WHERE (is_for_all='t') AND ( ("custom_fields"."type" = 'IssueCustomField' ) ) ORDER BY position[0m
  [4;35;1mIssueCustomField Load (0.0ms)[0m   [0mSELECT * FROM "custom_fields" INNER JOIN "custom_fields_projects" ON "custom_fields".id = "custom_fields_projects".custom_field_id WHERE ("custom_fields_projects".project_id = 2 ) AND ( ("custom_fields"."type" = 'IssueCustomField' ) ) ORDER BY custom_fields.position[0m
  [4;36;1mCACHE (0.0ms)[0m   [0;1mSELECT * FROM "users" WHERE ("users"."id" = 1) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) [0m
  [4;35;1mUser Load (0.0ms)[0m   [0mSELECT * FROM "users" WHERE ("users"."id" = 3) AND ( ("users"."type" = 'User' OR "users"."type" = 'AnonymousUser' ) ) [0m
  [4;36;1mCACHE (0.0ms)[0m   [0;1mSELECT * FROM "custom_fields" WHERE (is_for_all='t') AND ( ("custom_fields"."type" = 'IssueCustomField' ) ) ORDER BY position[0m
  [4;35;1mIssueCustomField Load (0.0ms)[0m   [0mSELECT * FROM "custom_fields" INNER JOIN "custom_fields_projects" ON "custom_fields".id = "custom_fields_projects".custom_field_id WHERE ("custom_fields_projects".project_id = 1 ) AND ( ("custom_fields"."type" = 'IssueCustomField' ) ) ORDER BY custom_fields.position[0m
Completed in 551ms (View: 20, DB: 10) | 200 OK [http://127.0.0.1/issues.xml?assigned_to=me]

Replies (2)

RE: REST API issues.xml with assigned_to - Added by Aja Hammerly almost 14 years ago

I'm seeing this as well. You can work around it by doing assigned_to_id=<your user ID>.

Assigned_to isn't a valid filter, its called assigned_to_id in the available filters.

RE: REST API issues.xml with assigned_to - Added by Dmit nitkin almost 14 years ago

Thanks.
'assigned_to_id=me' also works.
I think API wiki here should be changed

    (1-2/2)