API LIBRARY
Collapse Sidebar Menu
Expand Drawer

Listings and Photos

It's possible to retrieve listings and photos together in the same API call, using the query option $expand available only on WebAPI.  The result will include a list of listings, each of which contains a list of photos.

      Property?$top=10&$expand=Media

The $expand query option can recursively contain other WebAPI query options, such as $select, $filter, $top, $orderby.  For example, to retrieve only the first photo from each listing:

      Property?$top=10&$expand=Media($select=MediaURL;$top=1;$orderby=Order)


Examples

Code Example

https://api-prod.corelogic.com/trestle/odata/Property?$top=10&$select=ListingKey,StreetName&$filter=ListPrice+ge+100000&$expand=Media($select=MediaURL;$top=1;$orderby=Order) 

Result

{
    "@odata.context": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/$metadata#Property/CoreLogic.DataStandard.RESO.DD.Property",
    "@odata.nextLink": "https://realestate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property?$top=10&$select=ListingKey%2CStreetName&$filter=ListPrice ge 100000&$expand=Media%28%24select%3DMediaURL%3B%24top%3D1%3B%24orderby%3DOrder%29&$skip=10",
    "value": [
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')",
            "StreetName": "First Street",
            "ListingKey": "100000001",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('20000001')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000001/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/6WKyk5XGZrd-ofu2prvy5OIr6D1xOu3y-5riU3Yy5MI",
                    "X_MediaStream": "/odata/Media('20000001')/X_MediaStream/$value"
                }
            ]
        },
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')",
            "StreetName": "Second Street",
            "ListingKey": "100000002",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('200000002')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000002/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/al6eqSy49g6zLo6KdywppZFDCGyAO5kgVPj3FmWqMS0",
                    "X_MediaStream": "/odata/Media('200000002')/X_MediaStream/$value"
                }
            ]
        },		
		{"Comment": "8 more listings and media..."}
    ]
}

Code Example

curl -X GET \
  'https://realestate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property?$top=10&$select=ListingKey,StreetName&$filter=ListPrice+ge+100000&$expand=Media%28$select=MediaURL;$top=1;$orderby=Order%29' \
  -H 'Authorization: Bearer [token]' \
  -H 'cache-control: no-cache'

Result

{
    "@odata.context": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/$metadata#Property/CoreLogic.DataStandard.RESO.DD.Property",
    "@odata.nextLink": "https://realestate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property?$top=10&$select=ListingKey%2CStreetName&$filter=ListPrice ge 100000&$expand=Media%28%24select%3DMediaURL%3B%24top%3D1%3B%24orderby%3DOrder%29&$skip=10",
    "value": [
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')",
            "StreetName": "First Street",
            "ListingKey": "100000001",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('20000001')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000001/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/6WKyk5XGZrd-ofu2prvy5OIr6D1xOu3y-5riU3Yy5MI",
                    "X_MediaStream": "/odata/Media('20000001')/X_MediaStream/$value"
                }
            ]
        },
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')",
            "StreetName": "Second Street",
            "ListingKey": "100000002",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('200000002')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000002/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/al6eqSy49g6zLo6KdywppZFDCGyAO5kgVPj3FmWqMS0",
                    "X_MediaStream": "/odata/Media('200000002')/X_MediaStream/$value"
                }
            ]
        },		
		{"Comment": "8 more listings and media..."}
    ]
}

Code Example

<?php

$request = new HttpRequest();
$request->setUrl('https://realestate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property');
$request->setMethod(HTTP_METH_GET);

$request->setQueryData(array(
  '$top' => '10',
  '$select' => 'ListingKey,StreetName',
  '$filter' => 'ListPrice+ge+100000',
  '$expand' => 'Media%28$select=MediaURL;$top=1;$orderby=Order%29'
));

$request->setHeaders(array(
  'cache-control' => 'no-cache',
  'Authorization' => 'Bearer [Token]'
));

try {
  $response = $request->send();

  echo $response->getBody();
} catch (HttpException $ex) {
  echo $ex;
}

Result

{
    "@odata.context": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/$metadata#Property/CoreLogic.DataStandard.RESO.DD.Property",
    "@odata.nextLink": "https://realestate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property?$top=10&$select=ListingKey%2CStreetName&$filter=ListPrice ge 100000&$expand=Media%28%24select%3DMediaURL%3B%24top%3D1%3B%24orderby%3DOrder%29&$skip=10",
    "value": [
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000001')",
            "StreetName": "First Street",
            "ListingKey": "100000001",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('20000001')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000001/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/6WKyk5XGZrd-ofu2prvy5OIr6D1xOu3y-5riU3Yy5MI",
                    "X_MediaStream": "/odata/Media('20000001')/X_MediaStream/$value"
                }
            ]
        },
        {
            "@odata.type": "CoreLogic.DataStandard.RESO.DD.Property",
            "@odata.associationLink": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')/Media/$ref",
            "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Property('100000002')",
            "StreetName": "Second Street",
            "ListingKey": "100000002",
            "Media": [
                {
                    "@odata.type": "CoreLogic.DataStandard.RESO.DD.Media",
                    "@odata.id": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/odata/Media('200000002')",
                    "MediaURL": "https://RealEstate-trestle-dev-api.cfapps.dev1.uswest2.aws.clgx.cloud/Media/BIGBEAR/Property/jpeg/100000002/0/MTQwLzE2OA/MTEvNDY3LzE1NTU0MzI5ODk/al6eqSy49g6zLo6KdywppZFDCGyAO5kgVPj3FmWqMS0",
                    "X_MediaStream": "/odata/Media('200000002')/X_MediaStream/$value"
                }
            ]
        },		
		{"Comment": "8 more listings and media..."}
    ]
}