deleteUserByExtId

Beschreibung

Diese Methode löscht alle zu einem Nutzer gespeicherten Informationen im allyve Backend (Identifizierung des Datensatzes erfolgt über die Nutzer-ID auf Seiten der Consuming-Party).

Kommunikation zwischen

Consuming-Party Backend > allyve Backend

Request-URL

/api/sociallyve/protected/user

Methoden-Typ

DELETE

Request-Parameter

FeldBeschreibung
externalidDie von der Consuming-Party vergebene Nutzer-ID, die dem Sociallyve -Account zugeordnet ist.
partyidOptionaler Parameter zur Identifikation der aufrufenden Anwendung in den Statistiken

allyve-Backendaktivität

Löschen des kompletten Nutzerdatensatzes, die Einträge aller Provider zu dieser externalid sind betroffen.

Response

HTTP-Status

Response-Parameter

keine

Mögliche HTTP Error Codes

HTTP CodeBeschreibung
400Ein unbekannter Fehler ist aufgetreten.
404Der angegebene Benutzer wurde nicht gefunden.
409Konflikt bei den Eingabeparametern. Dieser Fehler tritt auf, wenn fälschlicherweise auch die Parameter provider oder uid gesetzt wurden.
500Beim Zugriff auf die Datenbank ist ein Fehler aufgetreten.

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/user';
 
//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);
curl_setopt ($curl, CURLOPT_CUSTOMREQUEST, 'DELETE');
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);
 
curl_setopt($curl, CURLOPT_POSTFIELDS, $queryStringSigned);
 
curl_exec($curl);
$info = curl_getinfo($curl);
 
curl_close($curl);
 
if (is_array($info) && isset($info['http_code']) && $info['http_code'] == 200) {
	echo 'ok';
} else {
	echo 'error';
}

Weiterführende Informationen

Zuletzt aktualisiert am 5. März 2012 von admin - Anmelden

Kommentare

Schreibe einen Kommentar