You are here

public function RestClient::getUpdated in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getUpdated()
  2. 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getUpdated()

Return a list of SFIDs for the given object for the given timeframe.

Parameters

string $name: Object type name, E.g., Contact, Account.

int $start: Unix timestamp for older timeframe for updates. Defaults to "-29 days" if empty.

int $end: Unix timestamp for end of timeframe for updates. Defaults to now.

Return value

array return array has 2 indexes: "ids": a list of SFIDs of those records which have been created or updated in the given timeframe. "latestDateCovered": ISO 8601 format timestamp (UTC) of the last date covered in the request.

Overrides RestClientInterface::getUpdated

See also

https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest...

File

src/Rest/RestClient.php, line 587

Class

RestClient
Objects, properties, and methods to communicate with the Salesforce REST API.

Namespace

Drupal\salesforce\Rest

Code

public function getUpdated($name, $start = NULL, $end = NULL) {
  if (empty($start)) {
    $start = strtotime('-29 days');
  }
  $start = urlencode(gmdate(DATE_ATOM, $start));
  if (empty($end)) {
    $end = time();
  }
  $end = urlencode(gmdate(DATE_ATOM, $end));
  return $this
    ->apiCall("sobjects/{$name}/updated/?start={$start}&end={$end}");
}