Feature #6779
Project JSON API
| Status: | Closed | Start date: | 2010-10-31 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | REST API | |||
| Target version: | 1.1.0 | |||
| Resolution: | Fixed |
Description
I doesn't seem to be possible to get projects as JSON
I did add this
def index
respond_to do |format|
>>>>>>> format.json { render :text => Project.visible.find(:all, :order => 'lft').to_json, :layout => false }
format.html {
@projects = Project.visible.find(:all, :order => 'lft')
}
format.xml {
@projects = Project.visible.find(:all, :order => 'lft')
}
format.atom {
projects = Project.visible.find(:all, :order => 'created_on DESC',
:limit => Setting.feeds_limit.to_i)
render_feed(projects, :title => "#{Setting.app_title}: #{l(:label_project_latest)}")
}
end
end
to make it work
in the
History
#1 Updated by Terence Mill over 1 year ago
nice alternative to complete redmine api, isn't it?
#2 Updated by Jean-Philippe Lang over 1 year ago
- Category changed from Projects to REST API
- Target version set to 1.1.0
#3 Updated by Eric Davis over 1 year ago
- Subject changed from Projects with JSON to Project JSON API
- Status changed from New to Assigned
- Assignee set to Eric Davis
- Priority changed from Low to Normal
- Estimated time deleted (
1.00)
Looks like the JSON api for projects was missed. I'm going to be reviewing the existing APIs and trying to clean them up over the next few weeks.
#4 Updated by Patrick Logé over 1 year ago
Great thank!
Another info:
I wanted to use JSON to create a mobile application with Rhomobile
I had problems with the "Issues" REST interface because of illegal characters.
Rhomobile have a "Rho::AsyncHttp.get" method to consume JSON services.
My Redmine instance return something like
[{"start_date":"2010/09/10","deliverable_id":211,"estimated_hours":null,"priority_id":4,"created_on":"2010/09/10 16:56:56
+0200","project_id":278,"root_id":8117,"lock_version":3,"lft":1,"fixed_version_id":113,"updated_on":"2010/09/13 20:47:44
+0200","subject":"Adaptations","id":8117,"done_ratio":90,"assigned_to_id":11,"tracker_id":2,"category_id":null,"parent_id":null,
"due_date":null,"status_id":2,"description":"Hello, Anglais =\u003E","author_id":255,"rgt":2}]
I noticed a problem with the last character "\u003E". Once replace by "\u003e" (lowercase) it worked !!
So I did modify the Issues controller to return lowercase UTF8 entities.
format.json {
j = @issues.to_json
j.gsub!(/(u00)(.?)(.?)/){|n| n.downcase}
render :text => j, :layout => false
}
instead of
format.json { render :text => @issues.to_json, :layout => false }
Strange....
I don't know where the problem comes from. I sent a ticket to Rhomobile
#5 Updated by James Hardy over 1 year ago
Patrick Logé wrote:
I noticed a problem with the last character "\u003E". Once replace by "\u003e" (lowercase) it worked !!
So I did modify the Issues controller to return lowercase UTF8 entities.
From http://www.ietf.org/rfc/rfc4627.txt?number=4627 section 2.5 defining JSON, a unicode escape sequence is:
a reverse solidus, followed
by the lowercase letter u, followed by four hexadecimal digits that
encode the character's code point. The hexadecimal letters A though
F can be upper or lowercase.
so it would appear to be the client library which is at fault
#6 Updated by Eric Davis over 1 year ago
- Assignee deleted (
Eric Davis)
I am stepping down from working on Redmine. If someone else is interesting in working on this issue, feel free to reassign it to them.
Eric Davis
#7 Updated by Jean-Philippe Lang over 1 year ago
- Status changed from Assigned to Closed
- Resolution set to Fixed
Projects JSON API available in r4456.