nodes and segments plural API calls
This commit is contained in:
parent
e799022131
commit
f4743c08ac
3 changed files with 33 additions and 2 deletions
|
@ -87,4 +87,18 @@ class NodeController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def nodes
|
||||||
|
response.headers["Content-Type"] = 'application/xml'
|
||||||
|
ids = params['nodes'].split(',').collect {|n| n.to_i }
|
||||||
|
if ids.length > 0
|
||||||
|
nodelist = Node.find(ids)
|
||||||
|
doc = get_xml_doc
|
||||||
|
nodelist.each do |node|
|
||||||
|
doc.root << node.to_xml_node
|
||||||
|
end
|
||||||
|
render :text => doc.to_s
|
||||||
|
else
|
||||||
|
render :nothing => true, :status => 400
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -80,4 +80,19 @@ class SegmentController < ApplicationController
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def segments
|
||||||
|
response.headers["Content-Type"] = 'application/xml'
|
||||||
|
ids = params['segments'].split(',').collect {|s| s.to_i }
|
||||||
|
if ids.length > 0
|
||||||
|
segmentlist = Segment.find(ids)
|
||||||
|
doc = get_xml_doc
|
||||||
|
segmentlist.each do |segment|
|
||||||
|
doc.root << segment.to_xml_node
|
||||||
|
end
|
||||||
|
render :text => doc.to_s
|
||||||
|
else
|
||||||
|
render :nothing => true, :status => 400
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,10 +5,12 @@ ActionController::Routing::Routes.draw do |map|
|
||||||
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
|
map.connect "api/#{API_VERSION}/node/create", :controller => 'node', :action => 'create'
|
||||||
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => nil
|
map.connect "api/#{API_VERSION}/node/:id/history", :controller => 'old_node', :action => 'history', :id => nil
|
||||||
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'rest', :id => nil
|
map.connect "api/#{API_VERSION}/node/:id", :controller => 'node', :action => 'rest', :id => nil
|
||||||
|
map.connect "api/#{API_VERSION}/nodes", :controller => 'node', :action => 'nodes', :id => nil
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/segment/create", :controller => 'segment', :action => 'create'
|
map.connect "api/#{API_VERSION}/segment/create", :controller => 'segment', :action => 'create'
|
||||||
map.connect "api/#{API_VERSION}/segment/:id/history", :controller => 'old_segment', :action => 'history'
|
map.connect "api/#{API_VERSION}/segment/:id/history", :controller => 'old_segment', :action => 'history'
|
||||||
map.connect "api/#{API_VERSION}/segment/:id", :controller => 'segment', :action => 'rest'
|
map.connect "api/#{API_VERSION}/segment/:id", :controller => 'segment', :action => 'rest'
|
||||||
|
map.connect "api/#{API_VERSION}/segments", :controller => 'segment', :action => 'segments', :id => nil
|
||||||
|
|
||||||
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
|
map.connect "api/#{API_VERSION}/way/create", :controller => 'way', :action => 'create'
|
||||||
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => nil
|
map.connect "api/#{API_VERSION}/way/:id/history", :controller => 'old_way', :action => 'history', :id => nil
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue