API LIBRARY
Collapse Sidebar Menu
Expand Drawer

Authentication in RETS

Description
Examples

Code Example

curl -X POST \
--output "token.json" \
--basic -u $username:$password \
-H "Content-Type: application/x-www-form-urlencoded;charset=UTF-8" \
-k -d "grant_type=client_credentials&scope=api&client_id=$username" \
'http://trestle.corelogic.com/oidc/connect/token'

Result

{"access_token":"token","expires_in":3600,"token_type":"Bearer"}

Code Example

<?php

$request = new HttpRequest();
$request->setUrl('https://api-prod.corelogic.com/trestle/odata/$metadata');
$request->setMethod(HTTP_METH_GET);

$request->setHeaders(array(
  'cache-control' => 'no-cache'
));

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

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

Result

{"access_token":"token","expires_in":3600,"token_type":"Bearer"}