Search code examples
phpcountphotorets

ezrets get total number of images


I'm using ezRets inside of php. I am trying to query for the number of images in a listing, given its listing id. I can't do this because I do not know the field name for the number of images

A full query to pass to ezrets would be awesome.

A URL query string to accomplish this in the rets web interface would be appreciated as well.

In the doc I found, here is a sample query for the web interface

http: //(your.rets.server)/rets/server/search?SearchType=Property & Class =ResidentialProperty&QueryType=DMQL2&Format=COMPACT&StandardNames=1 &Select=ListingID,ListPrice&Query=(ListPrice=300000%2B)&Count=1&Limit=10

then it mentions that there is a photo count field, but it does not specify the field name! It is not "PhotoCount" or "PhotoCnt".

Thanks!


Solution

  • What you need to do first is query the Metadata table for the particular Resource/Class you are looking for the PhotoCount column. These won't be 100% correct since I haven't ever used connectMLS, but you will get the idea.

    Use this query to get the metadata for the table Property: http://<connectMLS.rets.server.url>/rets/server/getmetadata?Type=METADATA- TABLE&Format=COMPACT&Type=Property&Class=ResidentialProperty

     <COLUMNS>
        SystemName    StandardName    LongName    DBName    ShortName    MaximumLength    DataType
      Precision    Searchable
        Interpretation    Alignment    UseSeparator    EditMaskID    LookupName    MaxSelect    Units
      Index    Minimum    Maximum
        Default    Required    SearchHelpID    Unique
     </COLUMNS>
    

    One of the available columns above will more than likely have a PICCount or Count or PhotoCounty something related to count. If if doesn't then you will just have to process your returned results and count them yourself.

    I hope this helps. It has taken me a little while to wrap my head around RETS.

    What particular MLS are you writing queries for?