refindlyllc / rets

A thin RETS client
MIT License
69 stars 26 forks source link

Keep getting RETS Error 20203: Miscellaneous Search Error: Invalid query type: DMQL2 when performing search #193

Closed Esko918 closed 6 years ago

Esko918 commented 6 years ago

Im trying to search for an item but every time I do I get RETS Error 20203: Miscellaneous Search Error: Invalid query type: DMQL2 error. IM able to connect to the client and get a list of all the resources but for some reason I cant search on the resource once I get them. Any idea? Heres the code. Any help would be appreciated.

rets_client = Session(login_url, username, password,version,user_agent) rets_client.login() resources = rets_client.get_class_metadata(resource='Property') system_data = rets_client.get_system_metadata() print(system_data)

properties = [] for class in resources: className = class['ClassName'] filter = { 'Status':'A' } try: result = rets_client.search('Property',className,search_filter=filter) properties.extend(result) except Exception as err: print(err) rets_client.logout() print (properties)

mcrowson commented 6 years ago

The DMQL this generates is ‘(Status=A)’ which is valid DMQL. Some vendors though (looking at you Rapitoni) require quote marks around stings so that you have to pass DMQL of ‘(Status=“A”)’.

So in your filter, just put quote marks around the A. You can also use the DMQL parameter and just type out the queries that way if you want to.

Esko918 commented 6 years ago

I tried enclosing the query in a perentheses, put quotes around everything, put quotes around the value. Nothing works. I keep getting the same error over and over. I think It might have to be the fact its sending over a DQML2 QUERY when the system might need a DQML query? I dont know. Long story short is that whoever wrote the older code to pull this information used PHRETS and for one reason and another the MLS Upgraded their system and we cant do anything to fix the issue with PHRETS. SO the workaround for now is to use python and a python library to pull the information and insert it into the database. I don't understand why this is happening and it gives no other information other than the error I am showing you.

mcrowson commented 6 years ago

What board is it?

mcrowson commented 6 years ago

And who is the RETS vendor?

Esko918 commented 6 years ago

I don't know what you mean by board. the rets vender is Long Island Real Estate

Esko918 commented 6 years ago

Could it be a python permission status issue? I don't think so since I was able to get other information from the Session class. Like the name of the class for the resource and even the list of the table columns

Esko918 commented 6 years ago

mlsli is the real estate vendor

Esko918 commented 6 years ago

I've tried dqml_query = '(Status=\'A\')', dqml_query = '(Status=\"A\")', dqml_query = 'Status=\'A\'. I keep coming back to the fact is that I think they want a DQML 1 query when its sending over a DQML2 query but I have no idea how to check that

mcrowson commented 6 years ago

Can you make a call to the server that returns data? If you can show me what request successfully gets you back the data we can figure out what part of the library isn't working as expected. Here's an example of what a GET request might look like.

http://someretsserver.com/search.aspx?SearchType=Property&Class=RESI&Query=%28Status%3D%22A%22%29%2C%28&QueryType=DMQL2&Count=1&Format=COMPACT-DECODED&StandardNames=0&Limit=1

Also, this doc by Flex on DMQL is helpful: https://www.flexmls.com/developers/rets/tutorials/dmql-tutorial/

mcrowson commented 6 years ago

Closing due to inactivity. Please reopen if the issue persists and you have more data to help troubleshoot.