1
我需要发布一些xml信息到restful api任何人都可以给我一个线索如何做到这一点?我正在使用rails。在rails中发布xml到休息api
我需要发布一些xml信息到restful api任何人都可以给我一个线索如何做到这一点?我正在使用rails。在rails中发布xml到休息api
在轨使用的ActiveResource,你做这样的:
class PersonResource < ActiveResource::Base
self.site = "http://api.people.com:3000/"
self.proxy = "http://user:[email protected]:8080"
end
ryan = Person.new(:first => 'Ryan', :last => 'Daigle')
# the next line posts this object serialized to xml to the configured url
ryan.save # => true
http://api.rubyonrails.org/classes/ActiveResource/Base.html
如果您正在发布到网站上有一个自定义的API(未激活的资源),你必须使用Net:HTTP