diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/public_body_controller.rb | 20 | ||||
-rw-r--r-- | app/views/help/api.rhtml | 4 |
2 files changed, 22 insertions, 2 deletions
diff --git a/app/controllers/public_body_controller.rb b/app/controllers/public_body_controller.rb index 560206900..0a2e72a5a 100644 --- a/app/controllers/public_body_controller.rb +++ b/app/controllers/public_body_controller.rb @@ -47,6 +47,26 @@ class PublicBodyController < ApplicationController @track_thing = TrackThing.create_track_for_public_body(@public_body) @feed_autodetect = [ { :url => do_track_url(@track_thing, 'feed'), :title => @track_thing.params[:title_in_rss] } ] + + respond_to do |format| + format.html { @has_json = true } + format.json { + render :json => { + :id => @public_body.id, + :url_name => @public_body.url_name, + :name => @public_body.name, + :short_name => @public_body.short_name, + # :request_email # we hide this behind a captcha, to stop people doing bulk requests easily + :created_at => @public_body.created_at, + :updated_at => @public_body.updated_at, + # :version, :last_edit_editor, :last_edit_comment # history, not done yet + :home_page => @public_body.calculated_home_page, + :notes => @public_body.notes, + :publication_scheme => @public_body.publication_scheme, + :tags => @public_body.tag_array, + } + } + end end def view_email diff --git a/app/views/help/api.rhtml b/app/views/help/api.rhtml index 9679f3cc7..6f34755b2 100644 --- a/app/views/help/api.rhtml +++ b/app/views/help/api.rhtml @@ -50,8 +50,8 @@ tips</a> for details. <h2> 3. JSON structured data </h2> -<p>Some pages have JSON feeds, which let you download information about objects -in a structured form. Find them by: +<p>Request and public authority pages have JSON feeds, which let you download +information about objects in a structured form. Find them by: <ul> <li>Adding <tt>.json</tt> to the end of the URL. </li> <li>Look for the <tt><link rel="alternate" type="application/json"></tt> tag in the head of the HTML. </li> |