プロジェクト

全般

プロフィール

Vote #68503

完了

Project JSON API

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

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

0%

予定工数:
category_id:
32
version_id:
20
issue_org_id:
6779
author_id:
17262
assigned_to_id:
0
comments:
7
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

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


journals

nice alternative to complete redmine api, isn't it?
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Great thank!

Another info:

I wanted to use JSON to create a mobile application with "Rhomobile":http://rhomobile.com
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
<pre>
[{"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}]
</pre>

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.

<pre>
format.json {
j = @issues.to_json
j.gsub!(/(u00)(.?)(.?)/){|n| n.downcase}
render :text => j, :layout => false
}
</pre>
instead of
<pre>
format.json { render :text => @issues.to_json, :layout => false }
</pre>

Strange....

I don't know where the problem comes from. I sent a ticket to Rhomobile

--------------------------------------------------------------------------------
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

--------------------------------------------------------------------------------
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

--------------------------------------------------------------------------------
Projects JSON API available in r4456.
--------------------------------------------------------------------------------

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

  • カテゴリREST API_32 にセット
  • 対象バージョン1.1.0_20 にセット

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

いいね!0
いいね!0