Created
July 18, 2019 14:49
-
-
Save librarywebchic/cb35b58434ffee07ac585ae6ed425e2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use OCLC\Auth\WSKey; | |
use OCLC\Auth\AccessToken; | |
use OCLC\User; | |
$key = 'api-key'; | |
$secret = 'api-key-secret'; | |
$services = array('SCIM'); | |
$user = new User('128807', 'principalID', 'principalIDNS'); | |
$options = array('services' => $services); | |
$wskey = new WSKey($key, $secret, $options); | |
$accessToken = $wskey->getAccessTokenWithClientCredentials(128807, 128807, $user); | |
$userid = 'something'; | |
$url = 'https://128807.share.worldcat.org/idaas/scim/v2/Users/'.$userid | |
$client = new Client(); | |
$headers = array(); | |
$headers['Authorization'] = 'Bearer ' . $accessToken->getValue(); | |
try { | |
$response = $client->request('GET', $url, ['headers' => $headers]); | |
echo $response->getBody(TRUE); | |
} catch (RequestException $error) { | |
echo $error->getResponse()->getStatusCode(); | |
echo $error->getResponse()->getBody(true); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment