Hi all,
I am trying to implement the yahoo shopping apis in my application. I am
trying to get the response using the XMLSimple. I am getting proper
result for the V1 and V2 product search. But V3 product search is not
working at all. Every time it give the error of "Invalid User Agent".
My
code snippet is:
url
URI.parse(''http://api.shopping.yahoo.com/ShoppingService/V3/productSearch'')
appid = ''xxxxxxxxxx''
post_args {
''appid'' => appid,
''department'' => sindex,
''query'' => ipod,
''start'' => 1,
''results'' =>25,
}
xml_data = Net::HTTP.post_form(url,post_args).body
data = XmlSimple.xml_in(xml_data)
return data
and the error message I am getting is:
#<Net::HTTPOK:0x48be634>
<?xml version="1.0" encoding="utf-8"?>
<Error xmlns="urn:yahoo:api"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:yahoo:api
http://api.yahoo.com/Api/V1/error.xsd">
The following errors were detected:
<Message>User-agent not valid</Message>
</Error>
I also tried with appending the user agent string in the request url
like this:
''User-Agent'' => ''Mozilla/5.0 (Windows; U; Windows
NT 5.1; en-US;
rv:1.8.0.1) Gecko/20060111 Firefox/1.5.0.1''
But It didn''t work. Please help me sorting out this issue. It is
blocking the flow of the application.
Thanks in advance.
asitk
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---