getUserinfoByExtId
Beschreibung
Über diese Methode werden die Informationen zu einem Nutzer abgerufen (Identifizierung des Datensatzes erfolgt über die Nutzer-ID auf Seite der Consuming-Party). Da eine externalId zu mehreren allyve-Accounts bei unterschiedlichen Providern zugeordnet sein kann, liefert diese Funktion eine Accountliste zurück, die einzelnen Objekte entsprechen im Aufbau denen der Funktion getUserinfo.
Kommunikation zwischen
Consuming-Party Backend > allyveBackend
Request-URL
/api/sociallyve/protected/user/info
Methoden-Typ
GET
Request-Parameter
| Feld | Beschreibung |
|---|---|
| externalid | Die von der Consuming-Party vergebene Nutzer-ID, die dem Sociallyve -Account zugeordnet ist. |
allyve-Backendaktivität
Laden und ausliefern des kompletten Nutzerdatensatzes
Response
JSON
Response-Parameter
Liste des UserObjects (siehe getUserinfo)
Die einzelnen Felder des UserObjects finden Sie HIER
Mögliche Http Error Codes
| HTTP Code | Beschreibung |
|---|---|
| 400 | Ein unbekannter Fehler ist aufgetreten. |
| 404 | Der angegebene Benutzer wurde nicht gefunden. |
| 409 | Konflikt bei den Eingabeparametern. Dieser Fehler tritt auf, wenn fälschlicherweise auch der Parameter externalid gesetzt wurde. |
| 500 | Fehler beim Zugriff auf die Datenbank |
Code-Beispiel: PHP
//Your application's credentials for using the API $myAppKey = '12345678910111213'; $myAppSecret = 'IWillNeverTellThisToAnyone'; //Set the correct URL to use $apiUrl = 'https://api.allyve.com/api/sociallyve/protected/user/info'; //construct an array with all the neccessary parameters needed for the request to the API $params["timestamp"] = time(); $params["applicationid"] = $myAppKey; $params["externalid"] = 'DarthVader'; //sort the parameters array alphabetically by the array keys ksort($params); //construct a temporary array, that will hold concatinated keys and values of the parameter array (key=value) $tempArray = array(); //walk over the parameter array and combine each key and value foreach ($params as $key => $value) { $tempArray[] = $key . "=" . $value; } //construct a properly formatted querystring from the combined key/values $queryStringUnsigned = implode("&", $tempArray); //construct the signature $querySignature = base64_encode(hash_hmac("sha1", $queryStringUnsigned, $myAppSecret, true)); //append the signature to the unsingend query string $queryStringSigned = $queryStringUnsigned . "&signature=" . urlencode($querySignature); //let's call the API with the help of CURL $curl = curl_init($apiUrl . '?' . $queryStringSigned); curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE); //If you do not have alredy set up a CA cert bundle in PEM format uncomment the next line, BUT YOU SHOULD NOT DO THAT IN PRODUCTION //curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); //If you have a CA cert bundle set the path to it (http://curl.haxx.se/docs/caextract.html) $pathToMyCertBundle = getcwd().'/cacert.pem'; curl_setopt($curl, CURLOPT_CAINFO, $pathToMyCertBundle); $result = curl_exec($curl); $info = curl_getinfo($curl); curl_close($curl); if (is_array($info) && isset($info['http_code']) && $info['http_code'] == 200) { echo 'ok'; print_r($result); } else { echo 'error'; }
Weiterführende Informationen
Zuletzt aktualisiert am 7. März 2012 von admin - Anmelden
