Skip to content

Filtering Results

Jon Druse edited this page Sep 3, 2019 · 2 revisions

You may only want to get results that meet a specific criteria. This is possible by supplying a filter with your query. If you do want to filter the results, it's suggested to ALWAYS send the same filters.

Here's an example:

query ReplicateListings(
  $mls_key: String!
  $latest_listing_event:Int!
  $listing_filter: [DataDictionaryFilterType]
) {
  mls(key: $mls_key) {
    key
    listings(last_event_id: $latest_listing_event filter: $listing_filter) {
      latest_event
      remaining
      results {
        EVENT_ID
        DELETED
        ListingId
        ListingKey
        UnparsedAddress
        StandardStatus
        PostalCode
        ListDate
        CloseDate
        BedroomsTotal
        BathroomsTotalInteger
        ListAgentKey
        ListAgentFullName
        ListAgentDirectPhone
        ForgeFeatures {
          name value
        }
      }
    }
  }
}

And now for the arguments:

{
  "mls_key": "armls",
  "latest_listing_event": 0,
  "listing_filter": [
    {"field": "ListDate", "gte": "2018-01-01" }
  ]
}

This will only return listings with ListDate after 2018-01-01.

Clone this wiki locally