{"action":"created","issue":{"url":"https://api.github.com/repos/publiclab/plots2/issues/1069","repository_url":"https://api.github.com/repos/publiclab/plots2","labels_url":"https://api.github.com/repos/publiclab/plots2/issues/1069/labels{/name}","comments_url":"https://api.github.com/repos/publiclab/plots2/issues/1069/comments","events_url":"https://api.github.com/repos/publiclab/plots2/issues/1069/events","html_url":"https://github.com/publiclab/plots2/issues/1069","id":193877728,"number":1069,"title":"JSON API for wiki pages","user":{"login":"jywarren","id":24359,"avatar_url":"https://avatars.githubusercontent.com/u/24359?v=3","gravatar_id":"","url":"https://api.github.com/users/jywarren","html_url":"https://github.com/jywarren","followers_url":"https://api.github.com/users/jywarren/followers","following_url":"https://api.github.com/users/jywarren/following{/other_user}","gists_url":"https://api.github.com/users/jywarren/gists{/gist_id}","starred_url":"https://api.github.com/users/jywarren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jywarren/subscriptions","organizations_url":"https://api.github.com/users/jywarren/orgs","repos_url":"https://api.github.com/users/jywarren/repos","events_url":"https://api.github.com/users/jywarren/events{/privacy}","received_events_url":"https://api.github.com/users/jywarren/received_events","type":"User","site_admin":false},"labels":[{"id":471889929,"url":"https://api.github.com/repos/publiclab/plots2/labels/fto-candidate","name":"fto-candidate","color":"bfd4f2","default":false},{"id":173349489,"url":"https://api.github.com/repos/publiclab/plots2/labels/help-wanted","name":"help-wanted","color":"0e8a16","default":false},{"id":343384842,"url":"https://api.github.com/repos/publiclab/plots2/labels/Ruby","name":"Ruby","color":"006b75","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2016-12-06T20:38:19Z","updated_at":"2016-12-20T14:27:21Z","closed_at":"2016-12-06T23:02:28Z","body":"Heard a request from @devinbalkind -- to access wiki pages.\r\n\r\nI think we could start by modifying this `show` method in the tag\r\ncontroller:\r\n\r\nhttps://github.com/publiclab/plots2/blob/master/app/controllers/tag_controller.rb#L16-L51\r\n\r\nThis ought to be in a new issue, but please feel free to copy over, or ask\r\nme and I can create one!\r\n\r\nWe could break out the response by format type, as is done on this line of\r\nSpectral Workbench:\r\n\r\nhttps://github.com/publiclab/spectral-workbench/blob/master/app/controllers/spectrums_controller.rb#L72-L76\r\n\r\nSo, like:\r\n\r\n```ruby\r\n    respond_with(@nodes) do |format|\r\n      format.html { render 'tag/show' }\r\n      format.xml  { render :xml => @nodes }\r\n      format.json  { render :json => @nodes }\r\n    end\r\n```\r\n\r\nThat'd make it possible to send a request similar to the usual one for wiki\r\npages, for example:\r\n\r\nhttps://publiclab.org/wiki/tag/tool (for the tag `tool` -- all tool pages, as Devin's expressed interest in)\r\n\r\nBut add a format to the request, like:\r\n\r\nhttps://publiclab.org/wiki/tag/pm.json\r\n\r\nAnd you'd receive `@nodes` in JSON format as a result.\r\n\r\nWe'd want to write a functional test for it too, and an API page entry, but\r\nthat should be pretty easy.\r\n\r\nA test could be added to:\r\n\r\nhttps://github.com/publiclab/plots2/blob/master/test/functional/tag_controller_test.rb\r\n\r\nand look like:\r\n\r\n```ruby\r\n  test \"tag show JSON\" do\r\n\r\n    get :show, id: tags(:spectrometer), format: 'json'\r\n\r\n    assert :success\r\n    assert_not_nil :tags\r\n\r\n    json = ActiveSupport::JSON.decode(@response)\r\n\r\n    assert_not_nil json\r\n    # assert more things to check this\r\n  end\r\n```\r\n\r\nThanks!!"},"comment":{"url":"https://api.github.com/repos/publiclab/plots2/issues/comments/268255998","html_url":"https://github.com/publiclab/plots2/issues/1069#issuecomment-268255998","issue_url":"https://api.github.com/repos/publiclab/plots2/issues/1069","id":268255998,"user":{"login":"jywarren","id":24359,"avatar_url":"https://avatars.githubusercontent.com/u/24359?v=3","gravatar_id":"","url":"https://api.github.com/users/jywarren","html_url":"https://github.com/jywarren","followers_url":"https://api.github.com/users/jywarren/followers","following_url":"https://api.github.com/users/jywarren/following{/other_user}","gists_url":"https://api.github.com/users/jywarren/gists{/gist_id}","starred_url":"https://api.github.com/users/jywarren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jywarren/subscriptions","organizations_url":"https://api.github.com/users/jywarren/orgs","repos_url":"https://api.github.com/users/jywarren/repos","events_url":"https://api.github.com/users/jywarren/events{/privacy}","received_events_url":"https://api.github.com/users/jywarren/received_events","type":"User","site_admin":false},"created_at":"2016-12-20T14:27:21Z","updated_at":"2016-12-20T14:27:21Z","body":"I believe it's working at https://publiclab.org/tag/tool.json -- and please open a new issue if you have specific metadata or fields requests. Thanks!"}}
{"actor":{"display_login":"jywarren"}}