LogoLogo
OverviewRelease NotesDataPipelineFAQs
Java
Java
  • Make Requests with ScraperAPI in Java
    • Use ScraperAPI Endpoint in Java
    • Use ScraperAPI Proxy Port in Java
    • Use ScraperAPI SDK in Java
    • Make Async Requests with ScraperAPI in Java
      • How to Use ScraperAPI Async Web Scraping in Java
      • Use Async ScraperAPI Callbacks in Java
      • Configure ScraperAPI Parameters in Java
      • Request Async Batch Scraping with ScraperAPI in Java
      • Decode Base64 Async Responses in Java
    • ScraperAPI Structured Data Collection in Java
      • Amazon Product Page API: Structured Data in Java
      • Amazon Search API: Structured Data in Java
      • Amazon Offers API: Structured Data in Java
      • Amazon Reviews API: Structured Data in Java
      • Ebay Product Page API: Structured Data in Java
      • Ebay Search API: Structured Data in Java
      • Google SERP API: Structured Data in Java
      • Google News API: Structured Data in Java
      • Google Jobs API: Structured Data in Java
      • Google Shopping API: Structured Data in Java
      • Google Maps Search API: Structured Data in Java
      • Redfin Agent Details API: Structured Data in Java
      • Redfin 'For Rent' Listings API: Structured Data in Java
      • Redfin 'For Sale' Listings API: Structured Data in Java
      • Redfin Listing Search API: Structured Data in Java
      • Walmart Search API: Structured Data in Java
      • Walmart Category API: Structured Data in Java
      • Walmart Product API: Structured Data in Java
      • Walmart Reviews API: Structured Data in Java
    • ScraperAPI Async Structured Data Collection in Java
      • Amazon Product Page API: Async Structured Data in Java
      • Amazon Search API: Async Structured Data in Java
      • Amazon Offers API: Async Structured Data in Java
      • Amazon Reviews API: Async Structured Data in Java
      • Ebay Product Page API: Async Structured Data in Java
      • Ebay Search API: Async Structured Data in Java
      • Google SERP API: Async Structured Data in Java
      • Google News API: Async Structured Data in Java
      • Google Jobs API: Async Structured Data in Java
      • Google Shopping API: Async Structured Data in Java
      • Google Maps Search API: Async Structured Data in Java
      • Redfin Agent Details API: Async Structured Data in Java
      • Redfin 'For Rent' Listings API: Async Structured Data in Java
      • Redfin 'For Sale' Listings API: Async Structured Data in Java
      • Redfin Listing Search API: Async Structured Data in Java
      • Walmart Search API: Async Structured Data in Java
      • Walmart Category API: Async Structured Data in Java
      • Walmart Product API: Async Structured Data in Java
      • Walmart Reviews API: Async Structured Data in Java
    • Making POST/PUT Requests with ScraperAPI in Java
    • Customizing ScraperAPI Requests in Java
      • Customize Amazon Requests by ZIP Code via ScraperAPI in Java
      • Customize Cached Results via ScraperAPI in Java
      • Customize Control Costs with ScraperAPI Parameter in Java
      • Send Custom Headers with ScraperAPI in Java
      • Customize Device Type with ScraperAPI in Java
      • Customize Geotargeted Content Scrape via ScraperAPI in Java
      • Customize Premium Geotargeted Scrape via ScraperAPI in Java
      • Customize Header Parameter with ScraperAPI in Java
      • Customize Premium Residential/Mobile Proxies in Java
      • Customize JavaScript-Rendered Pages via ScraperAPI in Java
        • Use Render Instruction Set to Scrape Dynamic Pages in Java
        • Customize Taking a Website Screenshots via ScraperAPI in Java
      • Customize Scrape Session-Based Proxies via ScraperAPI in Java
  • Handle and Process Responses via ScraperAPI in Java
    • Use API Status Codes to Retry Failed Requests in Java
    • Customize Output Formats via ScraperAPI Parameters in Java
      • Request JSON Response via Autoparse Parameter in Java
      • Request LLM Output Formats with ScraperAPI in Java
    • Request Response Encoding and Content-Type via ScraperAPI in Java
  • Dashboard & Billing
    • API Key
    • Credit Usage
    • Delete Account
    • Invoice History
    • Billing Email
    • Billing Address
    • VAT Number
    • Payment Method
    • Cancel Subscription
  • Credits and Requests
  • Monitor Your ScraperAPI Account Information in Java
  • Documentation Overview
Powered by GitBook

Quick links

  • Homepage
  • Dashboard
  • Pricing
  • Contact Sales

Resources

  • Developer Guides
  • Blog
  • Contact Support
  • Learning Hub
On this page

Was this helpful?

  1. Make Requests with ScraperAPI in Java
  2. ScraperAPI Structured Data Collection in Java

Redfin 'For Sale' Listings API: Structured Data in Java

Scrape Redfin For Sale pages in structured JSON/CSV with ScraperAPI in Java. Supports URL, country code, TLD, and raw data extraction for flexible scraping.

This endpoint will retrieve listing information from a single 'For Sale' property listing page and transform it into usable JSON.

try {
String apiKey = "API_KEY";
String urlString = "URL";
String country_code = "COUNTRY_CODE";
String tld = "TLD";
String raw = "RAW";
String url = "https://api.scraperapi.com/structured/redfin/forsale?api_key=" + apiKey + "&url=" + urlString + "&country_code=" + country_code + "&tld=" + tld + "&raw=" + raw;
URL urlForGetRequest = new URL(url);
String readLine = null;
HttpURLConnection conection = (HttpURLConnection) urlForGetRequest.openConnection();
conection.setRequestMethod("GET");
int responseCode = conection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(conection.getInputStream()));
StringBuffer response = new StringBuffer();
while ((readLine = in.readLine()) != null) {
response.append(readLine);
}
in.close();
System.out.println(response.toString());
} else {
throw new Exception("Error in API Call");
}
} catch (Exception ex) {
ex.printStackTrace();
}

Parameters
Details

API_KEY (required)

User's API Key.

URL (required)

The URL of the Redfin page. The URL has to be the URL of a property for sale.

country_code

TLD

The top level domain to scrape.

Valid options:

raw

This is a boolean param - true or false

If the raw parameter is set to true, the raw data will be extracted from the page without further parsing.

Important: The structure of the data in raw mode cannot be guaranteed, it’s a tradeoff: You get a lot more information back, but the structure of the response may change if Redfin modifies their page layout.

Sample Response

{
  "url": "https://redfin.com/NH/Salem/1-Chestnut-Dr-03079/home/96531263",
  "type": "for_sale",
  "image_urls": [
    "https://ssl.cdn-redfin.com/photo/154/bigphoto/196/5023196_0.jpg",
    "https://ssl.cdn-redfin.com/photo/154/bigphoto/196/5023196_1_0.jpg",
    ...
  ],
  "price": 899900,
  "currency": "$",
  "sq_ft": 2928,
  "price_per_sq_ft": 307,
  "latitude": 42.755854,
  "longitude": -71.2134495,
  "beds": 4,
  "baths": 2.5,
  "url_map": "https://maps.google.com/maps/api/staticmap?sensor=false&style=feature%3Aadministrative.land_parcel%7Cvisibility%3Aoff&style=feature%3Alandscape.man_made%7Cvisibility%3Aoff&style=feature%3Atransit.station%7Chue%3A0xffa200&center=42.755854%2C-71.2134495&channel=desktop_xdp_above_fold_static_preview&size=200x200&scale=1&format=jpg&zoom=11&client=gme-redfin&signature=UOuXHmn2QMUheU2YnGaziirBk9w=",
  "description": "Welcome to this pristine four-bedroom Colonial situated in a desirable cul-de-sac neighborhood. Thoughtfully cared for and updated this home offers a functional and welcoming layout featuring spacious rooms, hardwood floors throughout and plenty of natural light. The chef’s kitchen is the heart of the home with high-end stainless steel appliances, a 5 burner gas cooktop, custom cabinetry and a large quartz-topped island perfect for meal prep or casual dining. The main level also includes a comfortable living room a formal dining room for hosting and a cozy family room with a gas fireplace that’s perfect for gathering. Upstairs the primary suite offers a peaceful retreat with a private en-suite bath and walk-in closet. Three additional bedrooms provide flexibility for family, guests or a home office. Outside the backyard is ideal for relaxing or entertaining with a well-maintained lawn and a deck that’s r
  "address": "1 Chestnut Dr, Salem, NH 03079",
  "active": true,
  "agents": [
    {
      "name": "Caroleann M. Ohannessian",
      "broker_name": "RE/MAX Innovative Properties"
    }
  ],
  "amenities": {
    "stories": "2",
    "community": "Salem",
    "county": "Rockingham",
    "mls": "5023196",
    "built": "Built in 2002",
    "lot_size": "0.58 acres",
    "property_type": "Single-family",
    "heating_cooling": "Has A/C",
    "parking": "2 garage spaces"
  },
  "year_built": 2002,
  "property_type": "Single Family Residential",
  "schools": [
    {
      "name": "Dr. L. F. Soule School",
      "address": "173 S Policy St, Salem, NH 03079",
      "url": "http://redfin.com/school/135289/NH/Salem/Dr-L-F-Soule-School",
      "review_count": 3,
      "great_schools_rating": 4,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/434-Dr.-L.-F.-Soule-School/",
      "parent_rating": 4,
      "distance_in_miles": "0.8",
      "grade_ranges": "K-5",
      "institution_type": "Public",
      "number_of_students": 249,
      "student_to_teacher_ratio": 11
    },
    {
      "name": "Woodbury School",
      "address": "206 Main St, Salem, NH 03079",
      "url": "http://redfin.com/school/136522/NH/Salem/Woodbury-School",
      "review_count": 3,
      "great_schools_rating": 5,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/439-Woodbury-School/",
      "parent_rating": 2,
      "distance_in_miles": "1.9",
      "grade_ranges": "6-8",
      "institution_type": "Public",
      "number_of_students": 799,
      "student_to_teacher_ratio": 14
    },
    {
      "name": "Salem High School",
      "address": "44 Geremonty Dr, Salem, NH 03079",
      "url": "http://redfin.com/school/135508/NH/Salem/Salem-High-School",
      "review_count": 2,
      "great_schools_rating": 5,
      "great_school_url": "https://www.greatschools.org/new-hampshire/salem/438-Salem-High-School/",
      "parent_rating": 5,
      "distance_in_miles": "1.7",
      "grade_ranges": "9-12",
      "institution_type": "Public",
      "number_of_students": 1131,
      "student_to_teacher_ratio": 11
    }
  ],
  "similar_homes": [
    {
      "remarks": "Discover unparalleled luxury in this exquisite 4-bedroom, 3.5-bath estate overlooking Campbell's Scottish Highlands Golf Course. This masterpiece blends contemporary sophistication with timeless elegance. Enter the stately foyer into a world of refinement. To your right, an elegant dining room with wainscoting and tray ceiling awaits. Across, find a well-appointed office with tiled floor and an expansive window. The great room impresses with the first of two fireplaces, rich hardwood floors, and soaring vaulted ceilings, perfect for entertaining. From there, you head to the four seasons room which boasts the second stone gas fireplace and scenic views. Indulge your culinary passions in the c",
      "url": "http://redfin.com/NH/Salem/43-Ticklefancy-Ln-03079/home/60349931",
      "price": 1275000,
      "sq_ft": 5188,
      "beds": 4,
      "baths": 3.5,
      "stories": 1
    }
  ],
  "walk_score": 62,
  "bike_score": 37,
  "nearby_places": [
    {
      "name": "99 Restaurants",
      "address": "149 S Broadway, Salem, NH, 03079, us",
      "latitude": 42.76888656616211,
      "longitude": -71.21973419189453,
      "popularity": 0.5199999809265137,
      "phone_number": "(603) 893-5596",
      "website": "http://www.99restaurants.com/",
      "categories": [
        "Bar"
      ],
      "distance": 0.9563021208779819
    },
    {
      "name": "Peppers Pub",
      "address": "326 S Broadway, Salem, NH, 03079, us",
      "latitude": 42.75418472290039,
      "longitude": -71.20906066894531,
      "popularity": 0.10000000149011612,
      "categories": [
        "Bar",
        "Sports Bar",
        "Burger Joint",
        "Sandwich Restaurant"
      ],
      "distance": 0.25103686646367174
    },
    ...
  ],
  "transit": [
    {
      "stop_name": "Village Plaza -  Jo-Anns Fabrics",
      "latitude": 42.736726540051,
      "longitude": -71.196858494474,
      "routes": [
        {
          "short_name": "10",
          "long_name": "VILLAGE MALL VIA BROADWAY"
        },
        {
          "short_name": "10",
          "long_name": "Methuen Square"
        },
        {
          "short_name": "40",
          "long_name": "Methuen Square"
        }
      ]
    },
    {
      "stop_name": "Pelham Street Park & Ride",
      "latitude": 42.727395,
      "longitude": -71.200232,
      "routes": [
        {
          "short_name": "99",
          "long_name": "Methuen-Lawrence-Andover to Boston"
        }
      ]
    },
    ...
  ],
  "redfin_agent": "Sherre Dubis",
  "redfin_agent_average_rating": 10,
  "redfin_agent_url": "http://redfin.com/real-estate-agents/sherre-dubis",
  "redfin_agent_phone_number": "603-968-5261",
  "redfin_agent_deal_count": 232,
  "redfin_agent_volume": 92046099,
  "redfin_agent_highest_deal": 1300000,
  "url_map_2_x": "https://maps.google.com/maps/api/staticmap?sensor=false&style=feature%3Aadministrative.land_parcel%7Cvisibility%3Aoff&style=feature%3Alandscape.man_made%7Cvisibility%3Aoff&style=feature%3Atransit.station%7Chue%3A0xffa200&center=42.755854%2C-71.2134495&channel=ldp-minimap&path=color%3A0x2E7E36AA%7Cweight%3A1%7Cfillcolor%3A0x2E7E3633%7C42.7556517661979%2C-71.2136135592431%7C42.755652853304%2C-71.2136293929133%7C42.7556559108632%2C-71.2136447455755%7C42.7556608497788%2C-71.2136591683348%7C42.7556675261445%2C-71.2136722383488%7C42.7556757440131%2C-71.2136835759095%7C42.7556852653219%2C-71.2136928504789%7C42.755701061368%2C-71.2137021953775%7C42.7557599003748%2C-71.213722775569%7C42.7558199448114%2C-71.213735406652%7C42.7558806135693%2C-71.2137399682356%7C42.7559413186263%2C-71.2137364132741%7C42.7560014722875%2C-71.2137247777876%7C42.7561640281287%2C-71.2136878321098%7C42.7561751049447%2C-71.2136832168033%7C42.7561854509485%2
}

PreviousRedfin 'For Rent' Listings API: Structured Data in JavaNextRedfin Listing Search API: Structured Data in Java

Last updated 2 months ago

Was this helpful?

Allows you to geotarget the request. Use this parameter if you want Redfin to be scraped from a specific .

‘com’ (for )

‘ca’ (for )

country
redfin.com
redfin.ca