Project

General

Profile

Actions

Feature #39113

closed

Add missing Homepage attribute in Projects API response

Added by Vincent Robert about 1 year ago. Updated about 1 year ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
REST API
Target version:
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Fixed

Description

Hello

I'm submitting a patch that adds the missing 'homepage' attribute in the API response when requesting projects' index.

Thank you for considering this addition.

diff --git a/app/views/projects/index.api.rsb b/app/views/projects/index.api.rsb
index 03c7c0c77..1f8ff74f7 100644
--- a/app/views/projects/index.api.rsb
+++ b/app/views/projects/index.api.rsb
@@ -5,6 +5,7 @@ api.array :projects, api_meta(:total_count => @project_count, :offset => @offset
       api.name        project.name
       api.identifier  project.identifier
       api.description project.description
+      api.homepage    project.homepage
       api.parent(:id => project.parent.id, :name => project.parent.name) if project.parent && project.parent.visible?
       api.status      project.status
       api.is_public   project.is_public?
diff --git a/test/integration/api_test/projects_test.rb b/test/integration/api_test/projects_test.rb
index 4b0c79fae..1423b9c8f 100644
--- a/test/integration/api_test/projects_test.rb
+++ b/test/integration/api_test/projects_test.rb
@@ -43,6 +43,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
       assert_select '>status', :text => '1'
       assert_select '>is_public', :text => 'true'
       assert_select '>inherit_members', :text => 'true'
+      assert_select '>homepage', :text => 'http://ecookbook.somenet.foo/'
     end
   end

@@ -57,6 +58,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
     assert_kind_of Hash, json['projects'].first
     assert json['projects'].first.has_key?('id')
     assert json['projects'].first.has_key?('inherit_members')
+    assert json['projects'].first.has_key?('homepage')
   end

   test "GET /projects.xml with include=issue_categories should return categories" do
@@ -102,6 +104,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
     assert_select 'project>status', :text => '1'
     assert_select 'project>is_public', :text => 'true'
     assert_select 'project>inherit_members', :text => 'true'
+    assert_select 'project>homepage', :text => 'http://ecookbook.somenet.foo/'
     assert_select 'custom_field[name="Development status"]', :text => 'Stable'

     assert_select 'trackers', 0
@@ -118,6 +121,7 @@ class Redmine::ApiTest::ProjectsTest < Redmine::ApiTest::Base
     assert_equal false, json['project']['inherit_members']
     assert_equal false, json['project'].has_key?('default_version')
     assert_equal false, json['project'].has_key?('default_assignee')
+    assert_equal 'http://ecookbook.somenet.foo/', json['project']['homepage']
   end

   test "GET /projects/:id.xml with hidden custom fields should not display hidden custom fields" do

Files

missing_attribute.diff (2.46 KB) missing_attribute.diff Vincent Robert, 2023-09-25 17:18
Actions #1

Updated by Joan J about 1 year ago

HI Peter Steffek, it seems you are adding here a URL of your own, at least the url should be redmine.org, could you change it?

Actions #2

Updated by Go MAEDA about 1 year ago

  • Tracker changed from Patch to Feature
  • Subject changed from Add missing Homepage attribute in API response to Add missing Homepage attribute in Projects API response
  • Status changed from New to Closed
  • Assignee set to Go MAEDA
  • Target version set to 5.1.0
  • Resolution set to Fixed

Committed the patch in r22345. Thank you for your contribution.

Actions

Also available in: Atom PDF