getData
Beschreibung
Diese Methode holt mittels eines Token Daten ab, die in einem vorigen Schritt für dieses Token im allyve Backend gespeichert wurden (z.B. Kontakte/Social Graph des Nutzers oder das LoginObject nach erfolgreichem Login).
Kommunikation zwischen
Consuming-Party Backend > allyve Backend
Request-URL
/api/sociallyve/protected/token/data
Methoden-Typ
GET
Request-Parameter
| Feld | Beschreibung |
|---|---|
| sltoken | Token, um vom Sociallyve Backend entsprechend hinterlegte Daten (wie z.B. Kontakte) abholen zu können. |
allyve-Backendaktivität
Beschaffen der Daten aus dem temporären Speicher.
Response
JSON
Response-Parameter
| Feld | Beschreibung |
|---|---|
| resultList | Inhalte sind abhängig von den hinterlegten Daten. |
Unterstützte Datentypen der responseList:
- Liste von Contact Objekten.
- Liste von ContactImportData Objekten (immer genau ein Element in der Liste). Das ContactImportData Objekt hat zwei Eigenschaften: loginData (zur Typbeschreibung) und contactList (Liste von Contact Objekten)
Mögliche HTTP Error Codes
| HTTP Code | Beschreibung |
|---|---|
| 400 | Ein unbekannter Fehler ist aufgetreten. |
| 404 | Token nicht gefunden |
Code-Beispiel: PHP
//Your application's credentials for using the API $myAppKey = '12345678910111213'; $myAppSecret = 'IWillNeverTellThisToAnyone'; //Set the correct API URL to use $apiUrl = 'https://api.allyve.com/api/sociallyve/protected/protected/token/data'; //construct an array with all the neccessary parameters needed for the request to the API $params["timestamp"] = time(); $params["applicationid"] = $myAppKey; $params["sltoken"] = 'TheToken'; //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); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE); $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 8. Mai 2012 von admin - Anmelden
