I am trying to use ActiveResource to consume xml data from a third party API. I can use the RESTClient app to successfully authenticate and make requests. I coded my app and when I make a request I get a 404 error. I added:
ActiveResource::Base.logger = Logger.new(STDERR)
to my development.rb file and figured out the problem. The API responds with xml data to requests that do NOT end in xml. EG, this works in RESTClient:
https://api.example.com/contacts
but ActiveResource is sending this request instead
https://api.example.com/contacts.xml
Is there anyway "nice" way to strip the extension from the request being generated by ActiveResource?
Thanks
You can exclude the format string from paths with:
class MyModel < ActiveResource::Base
self.include_format_in_path = false
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With