Closed Sinetheta closed 8 years ago
I don't see the problem off hand either. If you pass in a logger with log level debug you can see exactly what URL the rets gem uses, can you compare that to curl and see how they are different?
@Sinetheta some rets servers require that you have the ID field in your query.
Have you tried:
client.find(:all, {
search_type: 'Property',
class: 'Property',
query: '(ID=*),(LastUpdated=2016-02-18T00:00:00+)',
})
Thanks for the reply @dougcole, that was my thought as well. The params are making it all the way, exactly in as I would suspect. The only things I can think of are
A) httpclient
escapes params differently than curl
. I've tried using CGI::escape
and URI.encode
on the query before passing it in, to no effect.
B) There is something unrelated which is different between the requests which is being tolerated when query: '(ID=*)'
but not when query: '(LastUpdated=2016-02-18T00:00:00+)'
for some reason.
I'll try inspecting the actual network traffic to see if I can spot the difference between the requests.
whoops! sorry, missed the part where it works over curl
That's fine @summera, you are right that our provider does claim to require the ID
field docs although the curl requests for a query by date only works fine.
Here are the curls I can make https://gist.github.com/Sinetheta/62267fc7ffbf1f148895
Here is the rets client call that works https://github.com/Sinetheta/3pr-rets/blob/master/app/controllers/pages_controller.rb
@Sinetheta I can't really try that code since I don't have a login to that Mls, but the code looks reasonable. I assume you've tried it with the same query in both ruby and curl?
Well, until I can provide network traffic information then there's not much to say. I can get by making (ID=*)
-> parse in ruby -> (ID=number)
queries, although I had intended to use LastUpdated
instead.
Thanks for the help. I'll let you know if I discover anything new.
So the problem was the +
. curl was stripping it but in all my ruby variations I was always including it.
+
invalid queryURI.encode('+') => "+"
you just tried thatCGI::escape('+') => "%2B"
still invalidIn retrospect, my MLS specifies
Query Syntax: (LastUpdated=RETSDateTime)
but I was focussed mainly on reproducing other people's examples and had unfortunately settled on a query which had an unwanted character :disappointed_relieved:
good sleuthing, thanks for the update!
Login works great, metadata works great, the following search works great
but if I try filtering
BAM
Got error code 20206 (Invalid Query Syntax)
This same query works great over curl. Am I missing something?