Namespace: BhrSdk\Exceptions
Extends: ClientException
HTTP Status Code: 401
Authentication failed
try {
// API call that might fail with 401 status code
} catch (BhrSdk\Exceptions\AuthenticationFailedException $e) {
// Handle the exception
echo $e->getMessage();
// Access additional information
$causes = $e->getPotentialCauses();
$tips = $e->getDebuggingTips();
// Access response data
$responseHeaders = $e->getResponseHeaders();
$responseBody = $e->getResponseBody();
}- Invalid API key or password
- Expired credentials
- Insufficient permissions for this operation
- Verify your API key and subdomain are correct
- Check that your API key has the necessary permissions
- Ensure your company subdomain is correct
- Try regenerating your API key in the BambooHR system
public function __construct(
string $message,
array $responseHeaders = [],
$responseBody = null
)| Name | Type | Description |
|---|---|---|
$message |
string | The error message |
$responseHeaders |
array | HTTP response headers from the API call |
$responseBody |
mixed | HTTP response body from the API call |
Returns an array of potential causes for this exception.
public function getPotentialCauses(): arrayReturns an array of debugging tips for this exception.
public function getDebuggingTips(): arrayReturns the HTTP response headers from the API call that triggered this exception.
public function getResponseHeaders(): arrayReturns the HTTP response body from the API call that triggered this exception.
public function getResponseBody()