You are here

public function Rules::get in Auth0 Single Sign On 8.2

Get a single rule by ID. Required scope: "read:rules"

@link https://auth0.com/docs/api/management/v2#!/Rules/get_rules_by_id

Parameters

string $id Rule ID to get.:

null|string|array $fields Fields to include or exclude from the result.:

null|boolean $include_fields True to include $fields, false to exclude $fields.:

Return value

mixed

Throws

CoreException Thrown when $id is empty or not a string.

\Exception Thrown by the HTTP client when there is a problem with the API call.

File

vendor/auth0/auth0-php/src/API/Management/Rules.php, line 78

Class

Rules
Class Rules. Handles requests to the Rules endpoint of the v2 Management API.

Namespace

Auth0\SDK\API\Management

Code

public function get($id, $fields = null, $include_fields = null) {
  if (empty($id) || !is_string($id)) {
    throw new CoreException('Invalid "id" parameter.');
  }
  $params = [];

  // Fields to include or exclude from results.
  if (!empty($fields)) {
    $params['fields'] = is_array($fields) ? implode(',', $fields) : $fields;
    if (null !== $include_fields) {
      $params['include_fields'] = $include_fields;
    }
  }
  return $this->apiClient
    ->method('get')
    ->addPath('rules', $id)
    ->withDictParams($params)
    ->call();
}